home *** CD-ROM | disk | FTP | other *** search
- ;This is the source file to create documentation for the IRIT solid modeler.
- ;First character in line specifies the action to take for this line/next block
- ;as follows:
- ; ';' - a comment that is always ignored.
- ; '#' - all lines following this line until next '#' are indented as an array.
- ; Four integers follow specifying indentations, # of elements per
- ; line, whether or not to put an internal vertical separator, and
- ; if entries are row ordered (1) or column ordered (2).
- ; '@' - latex only manual. Latex commands can appear within this line.
- ; '!' - plain text and irit docs only manual - keywords/headers.
- ; '&' - plain text only manual - headers.
- ; '$' - terminator for current block.
- ; '*' - prints line in all modes but without any latex filtering on the line.
- ; '%' - copied verbatim to all output types.
- ; latex commands can appear in regular text limited to a single line as
- ; {\command *}. For plain text the {\command } will be filtered out.
- ; Escaped characters via '\' (i.e. \#) will be left escaped (\#) in the
- ; latex output but unescaped (#) in the plain output.
- ; IRIT solid modeler (C) Gershon Elber 1991.
- @% Irit Solid modeler latex manual.
- @% Authors: Gershon Elber
- @% Date: Thu April 15, 1993
- @% Copyright (c) 1991/92/93 Gershon Elber
- @\documentstyle[11pt]{article}
- @\oddsidemargin -.2in
- @\evensidemargin -.2in
- @\textwidth 6.75in
- @\topmargin -.5in
- @\textheight 9.5in
- @\newcommand{\eqnref}[1]{(\ref{#1})}
- @\begin{document}
- @\pagestyle{empty}
- @ \rule{0in}{3in}
- @ \begin{center}
- @ {\huge\bf IRIT 4.0 User's Manual}\\
- @ \vspace{3cm}
- @ {\Large A Solid modeling Program}\\
- @ \vspace{2cm}
- @ {\large Copyright (C) 1989, 1990, 1991, 1992, 1993 Gershon Elber}\\
- @ \vspace{1cm}
- @ {\large EMail: gershon@cs.technion.ac.il }\\
- @ \vspace{2cm}
- @ {\large Join {\em IRIT} mailing list: gershon@cs.technion.ac.il }\\
- @ {\large Mailing list: irit-mail@cs.technion.ac.il }\\
- @ {\large Bug reports: irit-bugs@cs.technion.ac.il }\\
- @ \vfill
- @ {\small This manual is for IRIT version 4.0.}
- @ \end{center}
- @\newpage
- @\tableofcontents
- @\newpage
- @\setcounter{page}{1}
- @\markright{{\em {\bf Irit Solid modeler}}\hfil G. Elber}
- @\pagestyle{myheadings}
- @\newpage
- @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- @\section{Introduction}
- !INTRODUCTION
- {\em IRIT} is a solid modeler developed for educational purposes. Although
- small, it is now powerful enough to create quite complex scenes.
- {\em IRIT} started as a polygonal solid modeler and was originally developed
- on an IBM PC under MSDOS. Version 2.0 was also ported to X11 and version 3.0
- to SGI 4D systems. Version 3.0 also includes quite a few free form curves
- and surfaces tools. See the UPDATE.NEW file for more detailed update
- information. In Version 4.0, the display devices were enhanced, freeform
- curves and surfaces have further support, functions can be defined, and
- numerous improvement and optimizations are added.
- @\section{Copyrights}
- !COPYRIGHTS
- BECAUSE {\em IRIT} AND ITS SUPPORTING TOOLS AS DOCUMENTED IN THIS DOCUMENT
- ARE LICENSED FREE OF CHARGE, I PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT
- PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, I
- GERSHON ELBER PROVIDE THE {\em IRIT} PROGRAM AND ITS SUPPORTING TOOLS "AS IS"
- WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE.
- THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THESE PROGRAMS IS WITH
- YOU. SHOULD THE {\em IRIT} PROGRAMS PROVE DEFECTIVE, YOU ASSUME THE COST OF
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL GERSHON ELBER,
- BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES,
- OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
- USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR A
- FAILURE OF THE PROGRAMS TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY GERSHON
- ELBER) THE PROGRAMS, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
- @\smallskip
- {\em IRIT} is a freeware solid modeler. It is not public domain since I
- hold copyrights on it. However, unless you are to sell or attempt to make
- money from any part of this code and/or any model you made with this solid
- modeler, you are free to make anything you want with it.
- {\em IRIT} can be compiled and executed on numerous Unix systems as well
- as OS2, Windows NT and AmigaDOS. However, beware the MSDOS support is fading
- away.
- You are not obligated to me or to anyone else in any way by using {\em IRIT}.
- You are encouraged to share any model you made with it, but the models
- you made with it are {\em yours}, and you have no obligation to share them.
- You can use this program and/or any model created with it for non
- commercial and non profit purposes only. An acknowledgement on the way the
- models were created would be nice but is {\em not} required.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Command Line Options and Set Up of {\em IRIT}}
- !SETUP
- The {\em IRIT} program reads a file called {\bf irit.cfg} each time it is executed.
- This file configures the system. It is a regular text file with comments, so
- you can edit it and properly modify it for your environment.
- This file is being searched for in the directory specified by the
- IRIT\_PATH environment variable.
- For example 'setenv IRIT\_PATH /u/gershon/irit/bin/'.
- Note IRIT\_PATH must terminate with '/'. If the variable is not set only
- the current directory is being searched for {\bf irit.cfg}.
- In addition, if it exists, a file by the name of {\bf iritinit.irt} will be
- automatically executed before any other '.irt' file. This file may contain
- any {\em IRIT} command. It is the proper place to put your predefined
- functions and procedures if you have some.
- This file will be searched much the same way {\bf IRIT.CFG} is. The
- name of this initialization file may be changed by setting the StartFile
- entry in the configuration file.
- This file is far more important starting at version 4.0, because of the new
- function and procedure definition that has been added, and which is used
- to emulate BEEP, VIEW, and INTERACT for example.
- The solid modeler can be executed in text mode (see the .cfg and the -t
- flag below) on virtually any system with a C compiler.
- Under all systems the following environment variables must be set
- and updated:
- # 14 2 0 1
- path
- Add to path the directory where {\em IRIT}'s binaries are.
- IRIT\_PATH
- Directory with config., help and {\em IRIT}'s binary files.
- IRIT\_DISPLAY
- The graphics driver program/options. Must be in path.
- IRIT\_BIN\_IPC
- If set, uses binary Inter Process Communication.
- For example,
- @\begin{verbatim}
- set path = ($path /u/gershon/irit/bin)
- setenv IRIT_PATH /u/gershon/irit/bin/
- setenv IRIT_DISPLAY "xgldrvs -s-"
- setenv IRIT_BIN_IPC 1
- @\end{verbatim}
- to set /u/gershon/irit/bin as the binary directory and to use the sgi's
- gl driver. If IRIT\_DISPLAY is not set, the server (i.e., the {\em IRIT}
- program) will prompt and wait for you to run a client (i.e., a display
- driver). if IRIT\_PATH is not set, none of the configuration files, nor
- the help file will be found.
- If IRIT\_BIN\_IPC is not set, text based IPC is used, which is far
- slower. No real reason not to use IRIT\_BIN\_IPC, unless it does not
- work for you.
- In addition, the following optional environment variables may be set.
- # 17 2 0 1
- IRIT\_MALLOC
- If set, apply dynamic memory consistency testing.
- Programs will execute much slower in this mode.
- IRIT\_DEBUG\_FUNC
- prints debugging information on user's defined
- functions. If >0, invocation and leaving of functions.
- If >2, parameters and returned values as well. If >4
- global variable list is printed as well on invocation.
- IRIT\_SERVER\_HOST
- Internet Name of IRIT server (used by graphics driver).
- IRIT\_SERVER\_PORT
- Set a different socket port number than the default.
- For example,
- @\begin{verbatim}
- setenv IRIT_MALLOC 1
- setenv IRIT_SERVER_HOST irit.cs.technion.ac.il
- setenv IRIT_SERVER_PORT 5432
- @\end{verbatim}
- IRIT\_MALLOC is useful for programmers, or when reporting a memory
- fatal error occurrence. The IRIT\_SERVER\_HOST/PORT controls the
- server/client ({\em IRIT}/Display device) communication.
- IRIT\_SERVER\_HOST and IRIT\_SERVER\_PORT are used in the unix and
- Window NT ports of {\em IRIT}.
- See the section on the graphics drivers for more details.
- A session can be logged into a file as set via LogFile in the configuration
- file. See also the LOGFILE command.
- The following command line options are available:
- @\begin{verbatim}
- IRIT [-t] [-z] [file.irt]
- @\end{verbatim}
- # 10 2 1 1
- Puts {\em IRIT} into text mode. No graphics will be displayed and
- the display commands will be ignored. Useful when one needs to
- execute an irt file to create data on a tty device...
- Prints usage message and current configuration/version
- information.
- file.irt
- A file to invoke directly instead of waiting to input from
- stdin.
- @\subsection{IBM PC OS2 Specific Set Up}
- Under OS2 the IRIT\_DISPLAY environment variable must be set (if set) to
- os2drvs.exe without any option (-s- will be passed automatically).
- os2drvs.exe must be in a directory that is in the PATH environment
- variable. IRIT\_POS can be set to the X1 Y1 X2 Y2 dimensions of the
- window. IRIT\_BIN\_IPC can be used to signal binary IPC which is faster.
- Here is a complete example:
- @\begin{verbatim}
- %set IRIT_PATH=c:\irit\bin\
- set IRIT_DISPLAY=os2drvs.exe
- set IRIT_POS=230 120 550 460
- set IRIT_BIN_IPC=1
- @\end{verbatim}
- assuming the directory specified by IRIT\_PATH holds the executables of
- IRIT and is in PATH.
- If IRIT\_BIN\_IPC is not set, text based IPC is used which is far
- slower. No real reason not to use IRIT\_BIN\_IPC unless it does not
- work for you.
- @\subsection{IBM PC Window NT Specific Set Up}
- The NT port uses sockets and is, in this respect, similar to the unix port.
- The envirnoment variables IRIT\_DISPLAY, IRIT\_SERVER\_HOST,
- IRIT\_SERVER\_PORT, and IRIT\_BIN\_IPC should all be set in a similar
- way to the Unix specific setup. As a direct result, the server (IRIT)
- and the display device may be running on different hosts. For example
- the server might be running on an NT system while the display device
- will be running on an SGI4D exploiting the graphic's hardware
- capabilities.
- @\subsection{Unix Specific Set Up}
- Under UNIX using X11 (x11drvs driver) add the following options to
- your .Xdefaults. Most are self explanatory. The Trans attributes control
- the transformation window, while the View attributes control the view window.
- SubWin attributes control the subwindows within the Transformation window.
- # 33 2 0 1
- \#if COLOR
- irit*Trans*BackGround:
- NavyBlue
- irit*Trans*BorderColor:
- Red
- irit*Trans*BorderWidth:
- irit*Trans*TextColor:
- Yellow
- irit*Trans*SubWin*BackGround:
- DarkGreen
- irit*Trans*SubWin*BorderColor:
- Magenta
- irit*Trans*Geometry:
- =150x500+500+0
- irit*Trans*CursorColor:
- Green
- irit*View*BackGround:
- NavyBlue
- irit*View*BorderColor:
- Red
- irit*View*BorderWidth:
- irit*View*Geometry:
- =500x500+0+0
- irit*View*CursorColor:
- Red
- irit*MaxColors:
- \#else
- irit*Trans*Geometry:
- =150x500+500+0
- irit*Trans*BackGround:
- Black
- irit*View*Geometry:
- =500x500+0+0
- irit*View*BackGround:
- Black
- irit*MaxColors:
- \#endif
- @\section{First Usage}
- !FIRSTUSAGE
- Commands to {\em IRIT} are entered using a textual interface, usually
- from the same window the program was executed from.
- Some important commands to begin with are,
- 1. include("file.irt"); - will execute the commands in file.irt. Note
- include can be recursive up to 10 levels. To execute the demo
- (demo.irt) simply type 'include("demo.irt");'. Another way to run
- the demo is by typing demo(); which is a predefined procedure defined
- in iritinit.irt.
- 2. help(""); - will print all available commands and how to get help on
- them. A file called irit.hlp will be searched as irit.cfg is
- being searched (see above), to provide the help.
- 3. exit(); - close everything and exit {\em IRIT}.
- Most operators are overloaded. This means that you can multiply
- two scalars (numbers), or two vectors, or even two matrices, with the same
- multiplication operator ($*$). To get the on-line help on the
- operator '$*$' type 'help("$*$");'
- The best way to learn this program (like any other program...) is by
- trying it. Print the manual and study each of the commands available.
- Study the demo programs ($*$.irt) provided as well.
- The "best" mode to use irit is via the emacs editor. With this distribution
- an emacs mode for irit files (irt postfix) is provided (irit.el). Make your
- .emacs load this file automatically. Loading file.irt will switch emacs into
- Irit mode that supports the following three keystrokes:
- # 18 2 1 1
- Meta-E
- Executes the current line
- Meta-R
- Executes the current Region (Between Cursor and Mark)
- Meta-S
- Executes a single line from input buffer
- The first time one of the above keystrokes is hit, emacs will fork an Irit
- process so that Irit's stdin is controlled via the above commands.
- This emacs mode was tested under various unix environments and under OS2
- 2.x.
- @\section{Data Types}
- !DATATYPES
- These are the Data Types recognized by the solid modeler. They are also
- used to define the calling sequences of the different functions below:
- # 18 2 1 1
- {\bf ConstantType}
- Scalar real type that cannot be modified.
- {\bf NumericType}
- Scalar real type.
- {\bf VectorType}
- 3D real type vector.
- {\bf PointType}
- 3D real type point.
- {\bf CtlPtType}
- Control point of a freeform curve or surface.
- {\bf MatrixType}
- 4 by 4 matrix (homogeneous transformation matrix).
- {\bf PolygonType}
- Object consists of polygons.
- {\bf PolylineType}
- Object consists of polylines.
- {\bf CurveType}
- Object consists of curves.
- {\bf SurfaceType}
- Object consists of surfaces.
- {\bf GeometricType}
- One of Polygon/lineType, CurveType, SurfaceType.
- {\bf GeometricTreeType}
- A list of GeometricTypes or GeometricTreeTypes.
- {\bf StringType}
- Sequence of chars within double quotes - "A string".
- Current implementation is limited to 80 chars.
- {\bf AnyType}
- Any of the above.
- {\bf ListType}
- List of (any of the above type) objects. List
- size is dynamically increased, as needed.
- Although points and vectors are not the same, {\em IRIT} does not
- destinguish between them, most of the time. This might change in the future.
- @\section{Commands summary}
- !COMMANDS
- These are all the commands and operators supported by the {\em IRIT} solid
- modeler:
- # 11 6 1 0
- \verb+^+
- $==$
- $!=$
- $<=$
- $>=$
- ACOS
- ADAPISO
- AREA
- ASIN
- ATAN
- ATAN2
- ATTRIB
- AOFFSET
- BOOLONE
- BOOLSUM
- BSP2BZR
- BZR2BSP
- CBEZIER
- CBSPLINE
- CCINTER
- CCRVTR
- CDERIVE
- CDIVIDE
- CEDITPT
- CEVAL
- CEXTREMES
- CHDIR
- CINFLECT
- CIRCLE
- CIRCPOLY
- CMESH
- COERCE
- COLOR
- COMMENT
- CON2
- CONE
- CONVEX
- COORD
- COMPOSE
- CPOLY
- CRAISE
- CREFINE
- CREGION
- CROSSEC
- CRVLNDST
- CRVPTDST
- CSURFACE
- CTANGENT
- CTLPT
- CYLIN
- CZEROS
- EXIT
- EXTRUDE
- FFCOMPAT
- FREE
- FUNCTION
- GBOX
- GPOLYGON
- GPOLYLINE
- HELP
- HOMOMAT
- INCLUDE
- INTERACT
- LIST
- LISTSIZE
- LOAD
- LOGFILE
- MERGEPOLY
- OFFSET
- PAUSE
- PDOMAIN
- POLY
- PRINTF
- PRISA
- PROCEDURE
- ROTX
- ROTY
- ROTZ
- RULEDSRF
- SAVE
- SBEZIER
- SBSPLINE
- SCALE
- SDERIVE
- SDIVIDE
- SEDITPT
- SEVAL
- SFROMCRVS
- SMERGE
- SMORPH
- SNOC
- SNORMAL
- SNRMLSRF
- SPHERE
- SQRT
- SRAISE
- SREFINE
- SREGION
- STANGENT
- SURFREV
- SWEEPSRF
- SYMBCPROD
- SYMBDIFF
- SYMBDPROD
- SYMBPROD
- SYMBSUM
- SYSTEM
- TIME
- THISOBJ
- TORUS
- TRANS
- VARLIST
- VECTOR
- VIEW
- VIEWOBJ
- VOLUME
- @\section{Functions and Variables}
- !FUNCTIONS
- @ This section lists all the functions supported by the {\em IRIT} system
- @ according to their classes - mostly, the object type they return.
- Functions that return a {\bf NumericType}:
- # 11 5 1 0
- ACOS
- AREA
- ASIN
- ATAN
- ATAN2
- CPOLY
- LISTSIZE
- SQRT
- THISOBJ
- VOLUME
- Functions that return a {\bf GeometricType}:
- # 11 6 1 0
- ADAPISO
- AOFFSET
- BOOLONE
- BOOLSUM
- BSP2BZR
- BZR2BSP
- CBEZIER
- CBSPLINE
- CCINTER
- CCRVTR
- CDERIVE
- CDIVIDE
- CEDITPT
- CEVAL
- CEXTREMES
- CINFLECT
- CIRCLE
- CIRCPOLY
- CMESH
- COERCE
- COMPOSE
- CON2
- CONE
- CONVEX
- COORD
- CPOLY
- CRAISE
- CREFINE
- CREGION
- CROSSEC
- CRVLNDST
- CRVPTDST
- CSURFACE
- CTANGENT
- CTLPT
- CYLIN
- CZEROS
- EXTRUDE
- FFCOMPAT
- GBOX
- GPOLYGON
- GPOLYLINE
- MERGEPOLY
- OFFSET
- PDOMAIN
- POLY
- PRISA
- PROCEDURE
- RULEDSRF
- SBEZIER
- SBSPLINE
- SDERIVE
- SDIVIDE
- SEDITPT
- SEVAL
- SFROMCRVS
- SMERGE
- SMORPH
- SNORMAL
- SNRMLSRF
- SPHERE
- SRAISE
- SREFINE
- SREGION
- STANGENT
- SURFREV
- SWEEPSRF
- SYMBCPROD
- SYMBDIFF
- SYMBDPROD
- SYMBPROD
- SYMBSUM
- TORUS
- Functions that create linear transformation matrices:
- # 11 6 1 0
- HOMOMAT
- ROTX
- ROTY
- ROTZ
- SCALE
- TRANS
- Miscellaneous functions:
- # 11 6 1 0
- ATTRIB
- CHDIR
- COLOR
- COMMENT
- EXIT
- FREE
- FUNCTION
- HELP
- INCLUDE
- INTERACT
- LIST
- LOAD
- LOGFILE
- PAUSE
- PRINTF
- PROCEDURE
- SAVE
- SNOC
- SYSTEM
- TIME
- VARLIST
- VECTOR
- VIEW
- VIEWOBJ
- Variables that are predefined in the system:
- # 11 5 1 0
- AXES
- COPLANAR
- DRAWCTLPT
- DUMPLVL
- ECHOSRC
- FLAT4PLY
- INTERCRV
- MACHINE
- POLYSORT
- PRSP\_MAT
- RESOLUTION
- VIEW\_MAT
- Constants that are predefined in the system:
- # 11 6 1 0
- APOLLO
- BLACK
- BLUE
- CYAN
- FALSE
- GREEN
- KV\_FLOAT
- KV\_OPEN
- MAGENTA
- MSDOS
- TRUE
- UNIX
- WHITE
- YELLOW
- @\section{Language description}
- !LANGUAGE
- The front end of the {\em IRIT} solid modeler is an infix parser that
- mimics some of the C language behavior. The infix operators that are supported
- are plus (+), minus (-), multiply (*), divide (/), and power (\verb+^+), for
- numeric operators, with the same precedence as in C.
- However, unlike the C language, these operators are overloaded,
- @\footnote{In fact the C language does support overloaded operators to some
- @extent: '1 + 2' and '1.0 + 2.0' implies invocation of two different
- @actions.}
- or different action is taken, based upon the different operands.
- This means that one can write '1 + 2', in which the plus sign denotes a
- numeric addition, or one can write 'PolyObj1 + PolyObj2', in which case the
- plus sign denotes the Boolean operation of a union between two geometric
- objects.
- The exact way each operator is overloaded is defined below.
- In this environment, reals, integers, and even Booleans, are all represented
- as real types. Data are automatically promoted as necessary.
- For example, the constants TRUE and FALSE are defined as 1.0 and 0.0
- respectively.
- Each expression is terminated by a semicolon. An expression can be as
- simple as 'a;' which prints the value of variable a, or as complex as:
- @\begin{verbatim}
- for ( t = 1.1, 0.1, 1.9,
- cb1 = csurface( sb, COL, t ):
- color( cb1, green ):
- snoc( cb1, cb_all )
- );
- @\end{verbatim}
- While an expression is terminated with a semicolon, a colon is used to
- terminate mini-expressions within an expression.
- Once a complete expression is read in (i.e., a semicolon is detected)
- and parsed correctly (i.e. no syntax errors are found), it is executed.
- Before each operator or a function is executed, parameter type matching
- tests are made to make sure the operator can be applied to these
- operand(s), or that the function gets the correct set of arguments.
- The parser is totally case insensitive, so Obj, obj, and OBJ will refer
- to the same object, while MergePoly, MERGEPOLY, and mergePoly will refer
- to the same function.
- Objects (Variables if you prefer) need not be declared. Simply use them
- when you need them. Object names may be any alpha-numeric (and underscore)
- string of at most 30 characters. By assigning to an old object, the old
- object will be automatically deleted and if necessary its type will be
- modified on the fly.
- Example:
- @\begin{verbatim}
- V = sin( 45 * pi / 180.0 );
- V = V * vector( 1, 2, 3 );
- V = V * rotx( 90 );
- V = V * V;
- @\end{verbatim}
- will assign to V a NumericType equal to the sine of 45 degrees, the VectorType
- ( 1, 2, 3 ) scaled by the sine of 45, rotate that vector around the X axis
- by 90 degrees, and finally a NumericType which is the dot (inner) product of
- V with itself.
- The parser will read from stdin, unless a file is specified on the command
- line or an INCLUDE command is executed. In both cases, when the end of file
- is encountered, the parser will again wait for input from stdin. In order
- to execute a file and quit in the end of the file, put an EXIT command as
- the last command in the file.
- @\section{Operator overloading}
- @ The basic operators $+$, $-$, $*$, $/$, and \verb+^+ are overloaded.
- @ This section describes what action is taken by each of these operators
- @ depending on its arguments.
- @\subsection{Overloading $+$}
- The $+$ operator is overloaded above the following domains:
- @\begin{verbatim}
- NumericType + NumericType -> NumericType
- VectorType + VectorType -> VectorType (Vector addition)
- MatrixType + MatrixType -> MatrixType (Matrix addition)
- PolygonType + PolygonType -> PolygonType (Boolean UNION operation)
- CurveType + CurveType -> CurveType (Curve curve profiling)
- CurveType + CtlPtType -> CurveType (Curve control point profiling)
- CtlPtType + CtlPtType -> CurveType (Control points profiling)
- ListType + ListType -> ListType (Append lists operator)
- StringType + StringType -> StringType (String concat)
- StringType + RealType -> StringType (String concat, real as int string)
- @\end{verbatim}
- Note: Boolean UNION of two disjoint objects (no common volume) will result
- with the two objects combined. It is the USER responsibility to make sure that
- the non intersecting objects are also disjoint - this system only tests for
- no intersection.
- @\subsection{Overloading $-$}
- The $-$ operator is overloaded above the following domains:
- As a binary operator:
- @\begin{verbatim}
- NumericType - NumericType -> NumericType
- VectorType - VectorType -> VectorType (Vectoric difference)
- MatrixType - MatrixType -> MatrixType (Matrix difference)
- PolygonType - PolygonType -> PolygonType (Boolean SUBTRACT operation)
- @\end{verbatim}
- As a unary operator:
- @\begin{verbatim}
- - NumericType -> NumericType
- - VectorType -> VectorType (Scale vector by -1)
- - MatrixType -> MatrixType (Scale matrix by -1)
- - PolygonType -> PolygonType (Boolean NEGATION operation)
- - CurveType -> CurveType (Curve parameterization is reversed)
- - SurfaceType -> SurfaceType (Surface parameterization is reversed)
- @\end{verbatim}
- Note: Boolean SUBTRACT of two disjoint objects (no common volume) will result
- with an empty object. For both a curve and a surface parameterization, reverse
- operation (binary minus) causes the object normal to be flipped as a side
- effect.
- @\subsection{Overloading $*$}
- The $*$ operator is overloaded above the following domains:
- @\begin{verbatim}
- NumericType * NumericType -> NumericType
- VectorType * NumericType -> VectorType (Vector scaling)
- VectorType * VectorType -> NumericType (Inner product)
- MatrixType * NumericType -> MatrixType (Matrix Scaling)
- MatrixType * VectorType -> VectorType (Vector transformation)
- MatrixType * MatrixType -> MatrixType (Matrix multiplication)
- MatrixType * GeometricType -> GeometricType (Object transformation)
- MatrixType * ListType -> ListType (Object hierarchy transform.)
- PolygonType * PolygonType -> PolygonType (Boolean INTERSECTION operation)
- @\end{verbatim}
- Note: Boolean INTERSECTION of two disjoint objects (no common volume) will
- result with an empty object. Object hierarchy transform transforms any
- transformable object (GeometricType) found in the list recursively.
- @\subsection{Overloading $/$}
- The $/$ operator is overloaded above the following domains:
- @\begin{verbatim}
- NumericType / NumericType -> NumericType
- PolygonType / PolygonType -> PolygonType (Boolean CUT operation)
- @\end{verbatim}
- Note: Boolean CUT of two disjoint objects (no common volume) will result
- with an empty object.
- @\subsection{Overloading \^{\ }}
- The \verb+^+ operator is overloaded above the following domains:
- @\begin{verbatim}
- NumericType ^ NumericType -> NumericType
- VectorType ^ VectorType -> VectorType (Cross product)
- MatrixType ^ NumericType -> MatrixType (Matrix to the (int) power)
- PolygonType ^ PolygonType -> PolygonType (Boolean MERGE operation)
- StringType ^ StringType -> StringType (String concat)
- StringType ^ RealType -> StringType (String concat, real as real string)
- @\end{verbatim}
- Note: Boolean MERGE simply merges the two sets of polygons without any
- intersection tests. Matrix powers must be positive integers or -1, in which
- case the matrix inverse (if it exists) is computed.
- @\subsection{Assignments}
- Assignments are allowed as side effects, in any place in an expression.
- If "Expr" is an expression, then "var = Expr" is the exact same expression
- with the side effect of setting Var to that value. There is no guarantee
- on the order of evaluation, so using Vars that are set within the same
- expression is a bad practice. Use parentheses to force the order of
- evaluation, i.e., "( var = Expr )".
- @\subsection{Comparison operators $==$, $!=$, $<$, $>$, $<=$, $>=$}
- &Comparison operators ==, !=, <, >, <=, >=
- The conditional comparison operators can be applied to the following
- domains (o for a comparison operator):
- @\begin{verbatim}
- NumericType o NumericType -> NumericType
- StringType o StringType -> NumericType
- PointType o PointType -> NumericType
- VectorType o VectorType -> NumericType
- PlaneType o PlaneType -> NumericType
- @\end{verbatim}
- The returned NumericType is non-zero if the condition holds, or zero if
- not.
- For PointTypes, VectorTypes, and PlaneTypes, only $==$ and $!=$ comparisons
- are valid. This is either the same or different.
- For NumericTypes and StringTypes (uses strcmp) all comparisons are valid.
- @\subsection{Logical operators $\&\&$, $\|\|$, !}
- &Logical operators &&, ||, !
- Complex logical expressions can be defined using the logical {\em and} ($\&\&$),
- logical {\em or} ($\|\|$) and logical {\em not} (!). These operators can be applied
- to NumericTypes that are considered Boolean results. That is, true for a
- non-zero value, and false otherwise.
- The returned NumericType is true if both operands are true for the {\em and}
- operator, at least one is true for the {\em or} operator, and the operand is
- false for the {\em not} operator. In all other cases, a false is returned.
- To make sure Logical expressions are readable, the {\em and} and {\em or}
- operators are defined to have the {\em same} priority. Use parentheses to
- disambiguate a logical expression and to make it more readable.
- @\subsection{Priority of operators}
- &Priority of operators
- The following table lists the priority of the different operators.
- # 19 3 0 1
- Lowest
- Operator
- Name of operator
- priority
- comma
- colon
- $\&\&$, $\|\|$
- logical and, logical or
- =,==,!=,<=,>=,<,>
- assignment, equal, not equal, less
- equal, greater equal, less, greater
- +, -
- plus, minus
- *, /
- multiply, divide
- Highest
- \verb+^+
- power
- priority
- -, !
- unary minus, logical not
- @\subsection{Grammar}
- &Grammar
- The grammar of the {\em IRIT} parser follows similar guidelines as
- the C language for simple expressions. However, complex statements differ.
- See the IF, FOR, FUNCTION, and PROCEDURE below for the usage of these
- clauses.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Function Description}
- &Function Description
- @ The description below defines the parameters and returned values of the
- @ predefined functions in the system, using the notation of functions
- @ in ANSI C. Listed are all the functions in the system, in alphabetic
- @ order, according to their classes.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{NumericType returning functions}
- &NumericType returning functions
- @\subsubsection{ABS}
- @\begin{verbatim}
- NumericType ABS( NumericType Operand )
- @\end{verbatim}
- Returns the absolute value of the given {\bf Operand}.
- @\subsubsection{ACOS}
- !ACOS
- @\begin{verbatim}
- NumericType ACOS( NumericType Operand )
- @\end{verbatim}
- Returns the arc cosine value (in radians) of the given {\bf Operand}.
- @\subsubsection{AREA}
- !AREA
- @\begin{verbatim}
- NumericType AREA( PolygonType Object )
- @\end{verbatim}
- Returns the area of the given {\bf Object} (in object units). Returned is
- the area of the polygonal object, not the area of the primitive it might
- approximate.
- This means that the area of a polygonal approximation of a sphere will be
- returned, not the exact area of the sphere.
- @\subsubsection{ASIN}
- !ASIN
- @\begin{verbatim}
- NumericType ASIN( NumericType Operand )
- @\end{verbatim}
- Returns the arc sine value (in radians) of the given {\bf Operand}.
- @\subsubsection{ATAN}
- !ATAN
- @\begin{verbatim}
- NumericType ATAN( NumericType Operand )
- @\end{verbatim}
- Returns the arc tangent value (in radians) of the given {\bf Operand}.
- @\subsubsection{ATAN2}
- !ATAN2
- @\begin{verbatim}
- NumericType ATAN2( NumericType Operand1, NumericType Operand2 )
- @\end{verbatim}
- Returns the arc tangent value (in radians) of the given ratio:
- {\bf Operand1} / {\bf Operand2}, over the whole circle.
- @\subsubsection{COS}
- @\begin{verbatim}
- NumericType COS( NumericType Operand )
- @\end{verbatim}
- Returns the cosine value of the given {\bf Operand} (in radians).
- @\subsubsection{CPOLY}
- !CPOLY
- @\begin{verbatim}
- NumericType CPOLY( PolygonType Object )
- @\end{verbatim}
- Returns the number of polygons in the given polygonal {\bf Object}.
- @\subsubsection{EXP}
- @\begin{verbatim}
- NumericType EXP( NumericType Operand )
- @\end{verbatim}
- Returns the natural exponent value of the given {\bf Operand}.
- @\subsubsection{LISTSIZE}
- !LISTSIZE
- @\begin{verbatim}
- NumericType LISTSIZE( ListType List | PolyType Poly )
- @\end{verbatim}
- Returns the length of a list, if {\bf List}, or the number of polygons
- if {\bf Poly}. If, however, only one polygon is in {\bf Poly}, it returns
- the number of vertices in that polygon.
- Example:
- @\begin{verbatim}
- len = LISTSIZE( list( 1, 2, 3 ) );
- numPolys = LISTSIZE( axes );
- @\end{verbatim}
- will assign the value of 3 to the variable {\bf len}, and set {\bf numPolys}
- to the number of polylines in the axes object.
- @\subsubsection{LN}
- @\begin{verbatim}
- NumericType LN( NumericType Operand )
- @\end{verbatim}
- Returns the natural logarithm value of the given {\bf Operand}.
- @\subsubsection{LOG}
- @\begin{verbatim}
- NumericType LOG( NumericType Operand )
- @\end{verbatim}
- Returns the base 10 logarithm value of the given {\bf Operand}.
- @\subsubsection{SIN}
- @\begin{verbatim}
- NumericType SIN( NumericType Operand )
- @\end{verbatim}
- Returns the sine value of the given {\bf Operand} (in radians).
- @\subsubsection{SQRT}
- !SQRT
- @\begin{verbatim}
- NumericType SQRT( NumericType Operand )
- @\end{verbatim}
- Returns the square root value of the given {\bf Operand}.
- @\subsubsection{TAN}
- @\begin{verbatim}
- NumericType TAN( NumericType Operand )
- @\end{verbatim}
- Returns the tangent value of the given {\bf Operand} (in radians).
- @\subsubsection{THISOBJ}
- !THISOBJ
- @\begin{verbatim}
- NumericType THISOBJ( AnyType Object )
- @\end{verbatim}
- Returns the object type of the given {\bf Object}. This can be one of
- the constants NUMERIC\_TYPE, STRING\_TYPE, VECTOR\_TYPE, POINT\_TYPE,
- CTLPT\_TYPE, MATRIX\_TYPE, POLY\_TYPE, CURVE\_TYPE, or SURFACE\_TYPE.
- @\subsubsection{VOLUME}
- !VOLUME
- @\begin{verbatim}
- NumericType VOLUME( PolygonType Object )
- @\end{verbatim}
- Returns the volume of the given {\bf Object} (in object units). It returns
- the volume of the polygonal object, not the volume of the object it might
- approximate.
- This routine decomposes all non-convex polygons to convex ones as a side
- effect (see CONVEX).
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{GeometricType returning functions}
- &GeometricType returning functions
- @\subsubsection{ADAPISO}
- !ADAPISO
- @\begin{verbatim}
- CurveType ADAPISO( SurfaceType Srf, NumericType Dir, NumericType Eps,
- NumericType FullIso, NumericType SinglePath )
- @\end{verbatim}
- Constructs a {\em coverage} to {\bf Srf} using isocurve in the {\bf Dir} direction,
- so that for any point p on surface {\bf Srf}, there exists a point on one of
- the isocurves that is close to p within {\bf Eps}. If {\bf FullIso}, the
- extracted isocurves span the entire surface domain, otherwise they may
- span only a subset of the domain. If {\bf SinglePath}, an approximation to
- a single path (Hamiltonian path) that visits all isocurves is constructed.
- @\begin{verbatim}
- srf = sbezier( list( list( ctlpt( E3, -0.5, -1.0, 0.0 ),
- ctlpt( E3, 0.4, 0.0, 0.1 ),
- ctlpt( E3, -0.5, 1.0, 0.0 ) ),
- list( ctlpt( E3, 0.0, -0.7, 0.1 ),
- ctlpt( E3, 0.0, 0.0, 0.0 ),
- ctlpt( E3, 0.0, 0.7, -0.2 ) ),
- list( ctlpt( E3, 0.5, -1.0, 0.1 ),
- ctlpt( E3, -0.4, 0.0, 0.0 ),
- ctlpt( E3, 0.5, 1.0, -0.2 ) ) ) );
- aiso = ADAPISO( srf, COL, 0.1, FALSE, FALSE );
- @\end{verbatim}
- Constructs an adaptive isocurve approximation with tolerance of {\bf 0.1} to
- surface {\bf srf} in direction {\bf COL}. Isocurves are allowed to span a
- subset of the surface domain. No single path is needed.
- The {\bf SinglePath} option is currently not supported.
- @\subsubsection{ARC}
- @\begin{verbatim}
- CurveType ARC( VectorType StartPos, VectorType Center, VectorType EndPos )
- @\end{verbatim}
- Constructs an arc between the two end points {\bf StartPos} and {\bf EndPos},
- centered at {\bf Center}. Arc will always be less than 180 degrees, so the
- shortest circular path from {\bf StartPos} to {\bf EndPos} is selected. The
- case where {\bf StartPos}, {\bf Center}, and {\bf EndPos} are collinear is
- illegal, since it attempts to define a 180 degrees arc. Arc is constructed
- as a single rational quadratic Bezier curve.
- Example:
- @\begin{verbatim}
- Arc1 = ARC( vector( 1.0, 0.0, 0.0 ),
- vector( 1.0, 1.0, 0.0 ),
- vector( 0.0, 1.0, 0.0 ) );
- @\end{verbatim}
- constructs a 90 degrees arc, tangent to both the X and Y axes at coordinate 1.
- @\subsubsection{AOFFSET}
- !AOFFSET
- @\begin{verbatim}
- CurveType AOFFSET( CurveType Crv, NumericType OffsetDistance,
- NumericType Epsilon, NumericType TrimLoops )
- SurfaceType AOFFSET( SurfaceType Srf NumericType OffsetDistance,
- NumericType Epsilon, NumericType TrimLoops )
- @\end{verbatim}
- Computes an offset of {\bf OffsetDistance} with globally bounded error
- (controlled by {\bf Epsilon}). The smaller {\bf Epsilon} is, the better
- the approximation to the offset. The bounded error is achieved by adaptive
- refinement of the {\bf Crv}.
- If {\bf TrimLoops} is TRUE or on, the regions of the object that
- self-intersect as a result of the offset operation are trimmed away.
- Example:
- @\begin{verbatim}
- OffCrv = AOFFSET( Crv, 0.5, 0.03, TRUE );
- @\end{verbatim}
- computes an adaptive offset to {\bf Crv} with {\bf OffsetDistance} of
- 0.5 and {\bf Epsilon} of 0.03 and trims the self-intersection loops.
- See also OFFSET.
- @\subsubsection{BOOLONE}
- !BOOLONE
- @\begin{verbatim}
- SurfaceType BOOLONE( CurveType Crv )
- @\end{verbatim}
- Given a closed curve, the curve is subdivided into four segments equally
- spaced in the parametric space that are fed into BOOLSUM. Useful if
- a surface should "fill" the area enclosed by a closed curve.
- Example:
- @\begin{verbatim}
- Srf = BOOLONE( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
- @\end{verbatim}
- Creates a disk surface containing the area enclosed by the unit circle.
- @\subsubsection{BOOLSUM}
- !BOOLSUM
- @\begin{verbatim}
- SurfaceType BOOLSUM( CurveType Crv1, CurveType Crv2,
- CurveType Crv3, CurveType Crv4 )
- @\end{verbatim}
- Construct a surface using the provided four curves as its four boundary
- curves. Curves do not have to have the same order or type, and will be
- promoted to their least common denominator. The end points of the four
- curves should match as follows:
- # 30 2 0 1
- {\bf Crv1} start point,
- to {\bf Crv3} start point.
- {\bf Crv1} end point,
- to {\bf Crv4} start point.
- {\bf Crv2} start point,
- to {\bf Crv3} end point.
- {\bf Crv2} end point,
- to {\bf Crv4} end point.
- where {\bf Crv1} and {\bf Crv2} are the two boundaries in one parametric
- direction, and {\bf Crv3} and {\bf Crv4} are the two boundaries in the other
- parametric direction.
- Example:
- @\begin{verbatim}
- Cbzr1 = cbezier( list( ctlpt( E3, 0.1, 0.1, 0.1 ),
- ctlpt( E3, 0.0, 0.5, 1.0 ),
- ctlpt( E3, 0.4, 1.0, 0.4 ) ) );
- Cbzr2 = cbezier( list( ctlpt( E3, 1.0, 0.2, 0.2 ),
- ctlpt( E3, 1.0, 0.5, -1.0 ),
- ctlpt( E3, 1.0, 1.0, 0.3 ) ) );
- Cbsp3 = cbspline( 4,
- list( ctlpt( E3, 0.1, 0.1, 0.1 ),
- ctlpt( E3, 0.25, 0.0, -1.0 ),
- ctlpt( E3, 0.5, 0.0, 2.0 ),
- ctlpt( E3, 0.75, 0.0, -1.0 ),
- ctlpt( E3, 1.0, 0.2, 0.2 ) ),
- list( KV_OPEN ) );
- Cbsp4 = cbspline( 4,
- list( ctlpt( E3, 0.4, 1.0, 0.4 ),
- ctlpt( E3, 0.25, 1.0, 1.0 ),
- ctlpt( E3, 0.5, 1.0, -2.0 ),
- ctlpt( E3, 0.75, 1.0, 1.0 ),
- ctlpt( E3, 1.0, 1.0, 0.3 ) ),
- list( KV_OPEN ) );
- Srf = BOOLSUM( Cbzr1, Cbzr2, Cbsp3, Cbsp4 );
- @\end{verbatim}
- @\subsubsection{BOX}
- @\begin{verbatim}
- PolygonType BOX( VectorType Point,
- NumericType Dx, NumericType Dy, NumericType Dz )
- @\end{verbatim}
- Creates a BOX polygonal object, whose boundary is coplanar with the
- $XY$, $XZ$, and $YZ$ planes. The BOX is defined by {\bf Point} as
- base position, and {\bf Dx, Dy, Dz} as BOX dimensions. Negative dimensions
- are allowed.
- Example:
- @\begin{verbatim}
- B = BOX( vector( 0, 0, 0 ), 1, 1, 1);
- @\end{verbatim}
- creates a unit cube from 0 to 1 in all axes.
- @\subsubsection{BZR2BSP}
- !BZR2BSP
- @\begin{verbatim}
- CurveType BZR2BSP( CurveType Crv )
- SurfaceType BZR2BSP( SurfaceType Srf )
- @\end{verbatim}
- Creates a Bspline curve or a Bspline surface from the given Bezier curve or
- Bezier surface. The Bspline curve or surface is assigned open end knot
- vector(s) with no interior knots, in the parametric domain of zero to one.
- Example:
- @\begin{verbatim}
- BspSrf = BZR2BSP( BzrSrf );
- @\end{verbatim}
- @\subsubsection{BSP2BZR}
- !BSP2BZR
- @\begin{verbatim}
- CurveType | ListType BSP2BZR( CurveType Crv )
- SurfaceType | ListType BSP2BZR( SurfaceType Srf )
- @\end{verbatim}
- Creates Bezier curve(s) or surface(s) from a given Bspline curve or a
- Bspline surface. The Bspline input is subdivided at all internal knots to
- create Bezier curves or surfaces. Therefore, if the input Bspline does have
- internal knots, a list of Bezier curves or surfaces is returned. Otherwise,
- a single Bezier curve or surface is returned.
- Example:
- @\begin{verbatim}
- BzrCirc = BSP2BZR( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
- @\end{verbatim}
- would subdivide the unit circle into four 90 degrees Bezier arcs returned
- in a list.
- @\subsubsection{CBEZIER}
- !CBEZIER
- @\begin{verbatim}
- CurveType CBEZIER( ListType CtlPtList )
- @\end{verbatim}
- Creates a Bezier curve out of the provided control point list. {\bf CtlPtList}
- is a list of control points, all of which must be of the same type (E1-E5, P1-P5),
- defining the curve's control polygon.
- @The created curve is the polynomial (or rational),
- @\begin{equation}
- @ C(t) = \sum_{i=0}^k P_i B_i(t),
- @\end{equation}
- @where $P_i$ are the control points {\bf CtlPtList}, and k is the degree of
- @the curve, which is one less than the number of points.
- Example:
- @\begin{verbatim}
- s45 = sin(pi / 4);
- Arc90 = CBEZIER( list( ctlpt( P2, 1.0, 0.0, 1.0 ),
- ctlpt( P2, s45, s45, s45 ),
- ctlpt( P2, 1.0, 1.0, 0.0 ) ) );
- @\end{verbatim}
- constructs an arc of 90 degrees as a rational quadratic Bezier curve.
- @\subsubsection{CBSPLINE}
- !CBSPLINE
- @\begin{verbatim}
- CurveType CBSPLINE( NumericType Order, ListType CtlPtList,
- ListType KnotVector )
- @\end{verbatim}
- Creates a Bspline curve out of the provided control point list, the
- knot vector, and the specified order. {\bf CtlPtList} is a list of control
- points, all of which must be of the same type (E1-E5, P1-P5), defining the
- curve's control polygon. The length of the {\bf KnotVector} must be equal
- to the number of control points in {\bf CtlPtList} plus the {\bf Order}.
- The knot vector list may be specified as either {\bf list( KV\_OPEN )} or
- {\bf list( KV\_FLOAT )} in which a uniform open or uniform floating knot
- vector with the appropriate length is automatically constructed.
- @The created curve is the piecewise polynomial (or rational),
- @\begin{equation}
- @ C(t) = \sum_{i=0}^k P_i B_{i,\tau}(t),
- @\end{equation}
- @where $P_i$ are the control points {\bf CtlPtList} and k is the degree of
- @the curve, which is one less than the {\bf Order} or number of points.
- @$\tau$ is the knot vector of the curve.
- Example:
- @\begin{verbatim}
- s45 = sin(pi / 4);
- HalfCirc = CBSPLINE( 3,
- list( ctlpt( P3, 1.0, 0.0, 0.0, 1.0 ),
- ctlpt( P3, s45, -s45, 0.0, s45 ),
- ctlpt( P3, 1.0, -1.0, 0.0, 0.0 ),
- ctlpt( P3, s45, -s45, 0.0, -s45 ),
- ctlpt( P3, 1.0, 0.0, 0.0, -1.0 ) ),
- list( 0, 0, 0, 1, 1, 2, 2, 2 ) );
- @\end{verbatim}
- constructs an arc of 180 degrees in the XZ plane as a rational quadratic
- Bspline curve.
- @\subsubsection{CCINTER}
- !CCINTER
- @\begin{verbatim}
- ListType CCINTER( CurveType Crv1, CurveType Crv2, NumericType Epsilon,
- NumericType SelfInter )
- SurfaceType CCINTER( CurveType Crv1, CurveType Crv2, NumericType Epsilon,
- NumericType SelfInter )
- @\end{verbatim}
- Computes the intersection point(s) of {\bf Crv1} and {\bf Crv2} in the
- $XY$ plane. Since this computation involves numeric operations, {\bf Epsilon}
- controls the accuracy of the parametric values of the result.
- It returns a list of PointTypes, each containing the parameter of {\bf Crv1}
- in the X coordinate, and the parameter of {\bf Crv2} in the Y coordinate.
- If, however, {\bf Epsilon} is negative, a scalar field surface representing
- the square of the distance function is returned instead.
- If {\bf SelfInter} is TRUE, {\bf Crv1} and {\bf Crv2} can be the same
- curve, and self-intersection points are searched instead.
- Example:
- @\begin{verbatim}
- crv1 = cbspline( 3,
- list( ctlpt( E2, 0, 0 ),
- ctlpt( E2, 0.0.5 ),
- ctlpt( E2, 0.5, 0.7 ),
- ctlpt( E2, 1, 1 ) ),
- list( KV_OPEN ) );
- crv2 = cbspline( 3,
- list( ctlpt( E2, 1, 0 ),
- ctlpt( E2, 0.7, 0.25 ),
- ctlpt( E2, 0.3, 0.5 ),
- ctlpt( E2, 0, 1 ) ),
- list( KV_OPEN ) );
- inter_pts = CCINTER( crv1, crv2, 0.0001, FALSE );
- @\end{verbatim}
- Computes the parameter values of the intersection point of {\bf crv1} and
- {\bf crv2} to a tolerance of 0.0001.
- @\subsubsection{CCRVTR}
- !CCRVTR
- @\begin{verbatim}
- NumericType CCRVTR( CurveType Crv, NumericType Epsilon )
- CurveType CCRVTR( CurveType Crv, NumericType Epsilon )
- @\end{verbatim}
- Computes the extreme curvature points on {\bf Crv} in the $XY$ plane.
- This set includes not only points of maximum (convexity) and mimumum
- (concavity) curvature, but also points of zero curvature such as
- inflection points.
- Since this operation is partially numeric, {\bf Epsilon} is used to set
- the needed accuracy. It returns the parameter value(s) of the location(s)
- with extreme curvature along the {\bf Crv}.
- If, however, {\bf Epsilon} is negative, the curvature scalar field
- curve is returned as a two dimensional rational vector field curve, for
- which the first dimension is equal to the parameter, and the second is the
- curvature value at that parameter.
- @ This function computes the curvature scalar field for planar curves as,
- @\begin{equation}
- @ \kappa(t) = \frac{x'(t) y''(t) - x''(t) y'(t)}
- @ {\left( (x'(t))^2 + (y'(t))^2\ \right)^{\frac{3}{2}}},
- @\end{equation}
- @ and computes kN for three dimensional curves as the following vector field,
- @\begin{equation}
- @ \kappa(t) N(t) = \kappa(t) B(t) \times T(t) =
- @ \frac{C' \times C''}{\| C' \| ^ 3} \times \frac{C'}{\| C' \|} =
- @ \frac{(C' \times C'') \times C'}{\| C' \| ^ 4}.
- @\end{equation}
- ! This function computes the curvature scalar field for planar curves as,
- ! x' y'' - x'' y'
- ! k(t) = ----------------
- ! 2 2 3/2
- ! ( x' + y' )
- ! and computes kN for three dimensional curves as the following vector field,
- ! C' x C'' C' (C' x C'') x C'
- ! k(t) N(t) = K(t) B(t) x T(t) = -------- x ----- = ---------------
- ! 3 | C' | 4
- ! | C'| | C' |
- The extremum values are extracted from the computed curvature field.
- This curvature field is a high order curve, even if the input geometry is
- of low order. This is especially true for rational curves, for which the
- quotient rule for differentiation is used and almost doubles the degree
- in every differentiation.
- See also CZEROS, CEXTREMES, and CCRVTR.
- Example:
- @\begin{verbatim}
- crv = cbezier( list( ctlpt( E2, -1.0, 1.0 ),
- ctlpt( E2, -0.5, -2.0 ),
- ctlpt( E2, 0.0, 2.0 ),
- ctlpt( E2, 1.0, -1.0 ) ) );
- crvtr = ccrvtr( crv, 0.001 );
- pt_crvtr = nil();
- pt = nil();
- for ( i = 1, 1, listsize( crvtr ),
- pt = ceval( crv, nth( crvtr, i ) ) ):
- snoc( pt, pt_crvtr )
- interact( list( crv, pt_crvtr ) );
- @\end{verbatim}
- finds the extreme curvature points in {\bf Crv} and displays them all
- with the curve.
- @\subsubsection{CDERIVE}
- !CDERIVE
- @\begin{verbatim}
- CurveType CDERIVE( CurveType Curve )
- @\end{verbatim}
- Returns a vector field curve representing the differentiated curve,
- also known as the Hodograph curve.
- Example:
- @\begin{verbatim}
- Hodograph = CDERIVE( Crv );
- @\end{verbatim}
- @\subsubsection{CDIVIDE}
- !CDIVIDE
- @\begin{verbatim}
- ListType CDIVIDE( CurveType Curve, NumericType Param )
- @\end{verbatim}
- Subdivides a curve into two sub-curves at the specified parameter value.
- {\bf Curve} can be either a Bspline curve in which {\bf Param} must be
- within the Curve's parametric domain, or a Bezier curve in which {\bf Param}
- must be in the range of zero to one.
- It returns a list of the two sub-curves. The individual curves may be
- extracted from the list using the NTH command.
- Example:
- @\begin{verbatim}
- CrvLst = CDIVIDE( Crv, 0.5 );
- Crv1 = nth( CrvLst, 1 );
- Crv2 = nth( CrvLst, 2 );
- @\end{verbatim}
- subdivides the curve {\bf Crv} at the parameter value of 0.5.
- @\subsubsection{CEDITPT}
- !CEDITPT
- @\begin{verbatim}
- CurveType CEDITPT( CurveType Curve, CtlPtType CtlPt, NumericType Index )
- @\end{verbatim}
- Provides a simple mechanism to manually modify a single control point number
- {\bf Index} (base count is 0) in {\bf Curve}, by substituting {\bf CtlPt}
- instead. {\bf CtlPt} must have the same point type as the control points of
- the {\bf Curve}. Original curve {\bf Curve} is not modified.
- Example:
- @\begin{verbatim}
- CPt = ctlpt( E3, 1, 2, 3 );
- NewCrv = CEDITPT( Curve, CPt, 1 );
- @\end{verbatim}
- constructs a {\bf NewCrv} with the second control point of {\bf Curve} being
- {\bf CPt}.
- @\subsubsection{CEVAL}
- !CEVAL
- @\begin{verbatim}
- CtlPtType CEVAL( CurveType Curve, NumericType Param )
- @\end{verbatim}
- Evaluates the provided {\bf Curve} at the given {\bf Param} value.
- {\bf Param} should be in the curve's parametric domain if {\bf Curve} is
- a Bspline curve, or between zero and one if {\bf Curve} is a Bezier curve.
- The returned control point has the same point type as the control points
- of the {\bf Curve}.
- Example:
- @\begin{verbatim}
- CPt = CEVAL( Crv, 0.25 );
- @\end{verbatim}
- evaluates {\bf Crv} at the parameter value of 0.25.
- @\subsubsection{CEXTREMES}
- !CEXTREMES
- @\begin{verbatim}
- ListType CEXTREMES( CurveType Crv, NumericType Epsilon, NumericType Axis )
- @\end{verbatim}
- Computes the extreme set of the given {\bf Crv} in the given axis (1 for X,
- 2 for Y, 3 for Z). Since this computation is numeric, an {\bf Epsilon} is
- also required to specify the desired tolerance. It returns a list of
- all the parameter values (NumericType) in which the curve takes an extreme
- value.
- Example:
- @\begin{verbatim}
- extremes = cextremes( crv, 0.0001, 1 );
- @\end{verbatim}
- Computes the extreme set of curve {\bf crv}, in the {\bf X} axis, with
- error tolerance of {\bf 0.0001}. See also CZERO.
- @\subsubsection{CINFLECT}
- !CINFLECT
- @\begin{verbatim}
- ListType CINFLECT( CurveType Crv, NumericType Epsilon )
- CurveType CINFLECT( CurveType Crv, NumericType Epsilon )
- @\end{verbatim}
- Computes the inflection points of {\bf Crv} in the $XY$ plane.
- Since this computation is numeric, an {\bf Epsilon} is also required
- to specify the desired tolerance. It returns a list of all the
- parameter values (NumericType) in which the curve has an inflection point.
- If, however, {\bf Epsilon} is negative, a scalar field curve representing
- the sign of the curvature of the curve is returned instead.
- @ The sign of curvature scalar field is equal to,
- @\begin{equation}
- @ \sigma(t) = x'(t) y''(t) - x''(t) y'(t).
- @\end{equation}
- ! The sign of curvature scalar field is equal to
- ! s(t) = x' y'' - x'' y'
- Example:
- @\begin{verbatim}
- inflect = CINFLECT( crv, 0.001 );
- pt_inflect = nil();
- pt = nil();
- for ( i = 1, 1, listsize( inflect ),
- pt = ceval( crv, nth( inflect, i ) ):
- snoc( pt, pt_inflect )
- );
- interact( list( axes, crv, pt_inflect ), 0);
- @\end{verbatim}
- Computes the set of inflection points of curve {\bf crv} with error
- tolerance of {\bf 0.001}. This set is then scanned in a loop and
- evaluated to the curve's locations which are then displayed with the {\bf crv}.
- See also CZEROS, CEXTREMES, and CCRVTR.
- @\subsubsection{CIRCLE}
- !CIRCLE
- @\begin{verbatim}
- CurveType CIRCLE( VectorType Center, NumericType Radius )
- @\end{verbatim}
- Constructs a circle at the specified {\bf Center} with the specified
- {\bf Radius}. The returned circle is a Bspline curve of four piecewise Bezier
- 90 degree arcs. The construced circle is always parallel to the $XY$ plane.
- Use the linear transformation routines to place the circle in the appropriate
- orientation and location.
- @\subsubsection{CIRCPOLY}
- !CIRCPOLY
- @\begin{verbatim}
- PolygonType CIRCPOLY( VectorType Normal, VectorType Trans, NumericType Radius )
- @\end{verbatim}
- Defines a circular polygon in a plane perpendicular to {\bf Normal} that
- contains the {\bf Trans} point. Constructed polygon is centered at
- {\bf Trans}. RESOLUTION vertices will be defined with {\bf Radius} from
- distance from {\bf Trans}.
- Alternative ways to construct a polygon are manual construction of the
- vertices using POLY, or the construction of a flat ruled surface using
- RULEDSRF.
- @\subsubsection{CMESH}
- !CMESH
- @\begin{verbatim}
- CurveType CMESH( SurfaceType Srf, ConstantType Direction, NumericType Index )
- @\end{verbatim}
- Returns a single ROW or COLumn as specified by the {\bf Direction} and
- {\bf Index} (base count is 0) of the control mesh of surface {\bf Srf}.
- The returned curve will have the same knot vector as {\bf Srf} in the
- appropriate direction. See also CSURFACE.
- This curve is {\em not} necessarily in the surface {\bf Srf}.
- @It is equal to,
- @\begin{equation}
- @ C(t) = \sum_{i=0}^m P_{ij} B_i(t),
- @\end{equation}
- @and similar for the other parametric direction.
- Example:
- @\begin{verbatim}
- Crv = CMESH( Srf, COL, 0 );
- @\end{verbatim}
- extracts the first column of surface {\bf Srf} as a curve. See also
- @\subsubsection{COERCE}
- !COERCE
- @\begin{verbatim}
- AnyType COERCE( AnyType Object, ConstantType NewType )
- @\end{verbatim}
- Provides a coercion mechanism between different objects or object types.
- PointType, VectorType, PlaneType, CtlPtType can be all coerced to each
- other by using the {\bf NewType} of POINT\_TYPE, VECTOR\_TYPE, PLANE\_TYPE,
- or one of E1-E5, P1-P5 (CtlPtType). Similarly, CurveType and SurfaceType
- can be coerced to hold different CtlPtType of control points.
- Example:
- @\begin{verbatim}
- CrvE2 = COERCE( Crv, E2 );
- @\end{verbatim}
- coerce {\bf Crv} to a new curve that will have an E2 CtlPtType control
- points. Coerction of a projective curve (P1-P5) to a Euclidean curve
- (E1-E5) does not preseve the shape of the curve.
- @\subsubsection{COMPOSE}
- !COMPOSE
- @\begin{verbatim}
- CurveType COMPOSE( CurveType Crv1, CurveType Crv2 )
- CurveType COMPOSE( SurfaceType Srf, CurveType Crv )
- @\end{verbatim}
- Symbolically compute the composition curve {\bf Crv1(Crv2(t))} or
- {\bf Srf(Crv(t))}. In {\bf Crv1(Crv2(t)}, {\bf Crv1} can be any curve
- while {\bf Crv2} must be a one-dimensional curve that is either E1 or
- P1. In {\bf Srf(Crv(t))}, {\bf Srf} can be any surface, while {\bf Crv}
- must be a two-dimensional curve, that is either E2 or P2. Both {\bf Crv2}
- in the curve's composition, and {\bf Crv} is the surface's composition
- must be contained in the curve or surface parametric domain.
- Example:
- @\begin{verbatim}
- srf = sbezier( list( list( ctlpt( E3, 0.0, 0.0, 0.0 ),
- ctlpt( E3, 0.0, 0.5, 1.0 ),
- ctlpt( E3, 0.0, 1.0, 0.0 ) ),
- list( ctlpt( E3, 0.5, 0.0, 1.0 ),
- ctlpt( E3, 0.5, 0.5, 0.0 ),
- ctlpt( E3, 0.5, 1.0, 1.0 ) ),
- list( ctlpt( E3, 1.0, 0.0, 1.0 ),
- ctlpt( E3, 1.0, 0.5, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 1.0 ) ) ) );
- crv = coerce( circle( vector( 0.0, 0.0, 1.0 ), 0.4 ), p2 ) *
- trans( vector( 0.5, 0.5, 0.0 ) );
- comp_crv = COMPOSE( srf, crv );
- @\end{verbatim}
- compose a circle {\bf Crv} to be on the surface {\bf Srf}.
- @\subsubsection{CON2}
- !CON2
- @\begin{verbatim}
- PolygonType CON2( VectorType Center, VectorType Direction,
- NumericType Radius1, NumericType Radius2 )
- @\end{verbatim}
- Creates a truncated CONE geometric object, defined by {\bf Center} as the
- center of the main base of the CONE, {\bf Direction} as both the CONE's axis
- and the length of CONE, and the two radii {\bf Radius1/2} of the two bases of
- the CONE.
- Unlike the regular cone (CONE) constructor which has inherited
- discontinuities in its generated normals at the apex, CON2 can be used to
- form a (truncated) cone with continuous normals.
- See RESOLUTION for the accuracy of the CON2 approximation as a polygonal
- model.
- Example:
- @\begin{verbatim}
- Cone2 = CON2( vector( 0, 0, -1 ), vector( 0, 0, 4 ), 2, 1 );
- @\end{verbatim}
- constructs a truncated cone with bases parallel to the $XY$ plane at
- $Z = -1$ and $Z = 3$, and with radii of 2 and 1 respectively.
- @\subsubsection{CONE}
- !CONE
- @\begin{verbatim}
- PolygonType CONE( VectorType Center, VectorType Direction,
- NumericType Radius )
- @\end{verbatim}
- Creates a CONE geometric object, defined by {\bf Center} as the center of
- the base of the CONE, {\bf Direction} as the CONE's axis and height, and
- {\bf Radius} as the radius of the base of the CONE.
- See RESOLUTION for accuracy of the CONE approximation as a polygonal model.
- Example:
- @\begin{verbatim}
- Cone1 = CONE( vector( 0, 0, 0 ), vector( 1, 1, 1 ), 1 );
- @\end{verbatim}
- constructs a cone based in an $XY$ parallel plane, centered at the origin
- with radius 1 and with tilted apex at ( 1, 1, 1 ).
- See also CON2.
- @\subsubsection{CONVEX}
- !CONVEX
- @\begin{verbatim}
- PolygonType CONVEX( PolygonType Object )
- @\end{verbatim}
- Converts non-convex polygons in {\bf Object}, into convex ones. New vertices
- are introduced into the polygonal data during this process. The Boolean
- operations require the input to have convex polygons only (although it may
- return non convex polygons...) and it automatically converts non-convex input
- polygons to convex ones, using this same routine.
- However, some external tools (like irit2ray, poly3d-r and poly3d-h) require
- convex polygons. This function must be used on the objects to guarantee that
- only convex polygons are saved into data files for these external tools.
- @\begin{verbatim}
- CnvxObj = CONVEX( Obj );
- save( "data", CnvxObj );
- @\end{verbatim}
- converts non-convex polygons into convex ones, so that the data file can be
- used by external tools requiring convex polygons.
- @\subsubsection{COORD}
- !COORD
- @\begin{verbatim}
- AnyType COORD( AnyType Object, NumericType Index )
- @\end{verbatim}
- Extracts an element from a given {\bf Object}, at index {\bf Index}. From
- a PointType, VectorType, PlaneType, CtlPtType and MatrixType, a NumericType
- is returned with {\bf Index} 0 for the X axis, 1 for the Y axis etc.
- {\bf Index} 0 denotes the weight of CtlPtType. For a PolygonType that
- contains more than one polygon, the {\bf Index}th polygon is returned. For
- a PolygonType that contains a single Polygon, the {\bf Index}th vertex is
- returned. For a CurveType or a SurfaceType, the {\bf Index}th CtlPtType is
- returned. For a ListType, COORD behaves like NTH and returns the {\bf Index}th
- object in the list.
- Example:
- @\begin{verbatim}
- a = vector( 1, 2, 3 );
- vector( COORD( a, 0 ), COORD( a, 1 ), COORD( a, 2 ) );
- a = ctlpt( P2, 6, 7, 8, 9 );
- ctlpt( P3, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
- a = plane( 10, 11, 12, 13 );
- plane( COORD( a, 0 ), COORD( a, 1 ), COORD( a, 2 ), COORD( a, 3 ) );
- @\end{verbatim}
- constructs a vector/ctlpt/plane and reconstructs it by extracting the
- constructed scalar components of the objects using COORD.
- See also COERCE.
- @\subsubsection{CRAISE}
- !CRAISE
- @\begin{verbatim}
- CurveType CRAISE( CurveType Curve, NumericType NewOrder )
- @\end{verbatim}
- Raise {\bf Curve} to the {\bf NewOrder} Order specified.
- Example:
- @\begin{verbatim}
- Crv = ctlpt( E3, 0.0, 0.0, 0.0 ) +
- ctlpt( E3, 0.0, 0.0, 1.0 ) +
- ctlpt( E3, 1.0, 0.0, 1.0 );
- Crv2 = CRAISE( Crv, 4 );
- @\end{verbatim}
- raises the 90 degrees corner linear Bspline curve {\bf Crv} to be a cubic.
- @\subsubsection{CREFINE}
- !CREFINE
- @\begin{verbatim}
- CurveType CREFINE( CurveType Curve, NumericType Replace, ListType KnotList )
- @\end{verbatim}
- Provides the ability to {\bf Replace} a knot vector of {\bf Curve}, or refine
- it. {\bf KnotList} is a list of knots to refine {\bf Curve} at. All knots
- should be contained in the parametric domain of the {\bf Curve}. If the knot
- vector is replaced, the length of {\bf KnotList} should be identical to the
- length of the original knot vector of the {\bf Curve}. If {\bf Curve} is a
- Bezier curve, it is automatically promoted to be a Bspline curve.
- Example:
- @\begin{verbatim}
- Crv2 = CREFINE( Crv, FALSE, list( 0.25, 0.5, 0.75 ) );
- @\end{verbatim}
- refines {\bf Crv} and adds three new knots at 0.25, 0.5, and 0.75.
- @\subsubsection{CREGION}
- !CREGION
- @\begin{verbatim}
- CurveType CREGION( CurveType Curve, NumericType MinParam,
- NumericType MaxParam )
- @\end{verbatim}
- Extracts a region from {\bf Curve} between {\bf MinParam} and {\bf MaxParam}.
- Both {\bf MinParam} and {\bf MaxParam} should be contained in the
- parametric domain of the {\bf Curve}.
- Example:
- @\begin{verbatim}
- SubCrv = CREGION( Crv, 0.3, 0.6 );
- @\end{verbatim}
- extracts the region from {\bf Crv} from the parameter value 0.3 to the
- parameter value 0.6.
- @\subsubsection{CROSSEC}
- !CROSSEC
- @\begin{verbatim}
- PolygonType CROSSEC( PolygonType Object )
- @\end{verbatim}
- ; Invoke interactive mode to edit/create a polygon in the plane Z = 0. The
- ; polygon must be in the domain [0..1] in X,Y. The first polygon of the given
- ; Object is copied to begin with. If the given {\bf Operand} is NOT a geometric
- ; object, but FALSE (numeric 0.0), a new polygon is created. Returns an (open)
- ; object with this one polygon only and inside side of $+Z$. Note that if the
- ; given polygon (first polygon of Object) is not on the $XY$ plane, it is transformed
- ; to it before editing, and transformed back after.
- This feature is NOT implemented.
- @\subsubsection{CRVLNDST}
- !CRVLNDST
- @\begin{verbatim}
- NumericType CRVLNDST( CurveType Crv, PointType PtOnLine, VectorType LnDir,
- NumericType IsMinDist, NumericType Epsilon )
- ListType CRVLNDST( CurveType Crv, PointType PtOnLine, VectorType LnDir,
- NumericType IsMinDist, NumericType Epsilon )
- @\end{verbatim}
- Computes the closest (if {\bf IsMinDist} is TRUE, farthest if FALSE) point
- on {\bf Curve} to the line specified by {\bf PtOnLine} and {\bf LnDir} as a
- point on the line and a line direction.
- Since this operation is partially numeric, {\bf Epsilon} is used to set
- the needed accuracy. It returns the parameter value of the location on
- {\bf Crv} closest to the line.
- If, however, {\bf Epsilon} is negative, -{\bf Epsilon} is used instead,
- and all local extrema in the distance function are returned as a list
- (both minima and maxima).
- If the line and the curve intersect, the point of intersection is
- returned as the minimum.
- Example:
- @\begin{verbatim}
- Param = CRVLNDST( Crv, linePt, lineVec, TRUE, 0.001 );
- @\end{verbatim}
- finds the closest point on {\bf Crv} to the line defined by {\bf linePt}
- and {\bf lineVec}.
- @\subsubsection{CRVPTDST}
- !CRVPTDST
- @\begin{verbatim}
- NumericType CRVPTDST( CurveType Crv, PointType Point, NumericType IsMinDist,
- NumericType Epsilon )
- ListType CRVPTDST( CurveType Crv, PointType Point, NumericType IsMinDist,
- NumericType Epsilon )
- @\end{verbatim}
- Computes the closest (if {\bf IsMinDist} is TRUE, farthest if FALSE) point
- on {\bf Crv} to {\bf Point}.
- Since this operation is partially numeric, {\bf Epsilon} is used to set
- the needed accuracy. It returns the parameter value of the location on
- {\bf Crv} closest to {\bf Point}.
- If, however, {\bf Epsilon} is negative, -{\bf Epsilon} is used instead,
- and all local extrema in the distance function are returned as a list
- (both minima and maxima).
- Example:
- @\begin{verbatim}
- Param = CRVPTDST( Crv, Pt, FALSE, 0.0001 );
- @\end{verbatim}
- finds the farthest point on {\bf Crv} from point {\bf Pt}.
- @\subsubsection{CSURFACE}
- !CSURFACE
- @\begin{verbatim}
- CurveType CSURFACE( SurfaceType Srf, ConstantType Direction,
- NumericType Param )
- @\end{verbatim}
- Extract an isoparametric curve out of {\bf Srf} in the specified
- {\bf Direction} (ROW or COL) at the specified parameter value {\bf Param}.
- {\bf Param} must be contained in the parametric domain of {\bf Srf} in
- {\bf Direction} direction.
- The returned curve is {\em in} the surface {\bf Srf}.
- @It is equal to,
- @\begin{equation}
- @ C(t) = S(t, v_0) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_i(t) B_j(v_0) =
- @ \sum_{i=0}^m \left( \sum_{j=0}^n P_{ij} B_j(u_0) \right) B_i(t) =
- @ \sum_{i=0}^m Q_i B_i(t),
- @ \label{eqn-crv-from-srf}
- @\end{equation}
- @where $Q_i = \sum_{j=0}^n P_{ij} B_j(u_0)$ are the coefficients of the
- @returned curve, and similar for the other parametric direction $S(u_0, t)$.
- @{\bf param} is $v_0$ is equation~\eqnref{eqn-crv-from-srf}
- Example:
- @\begin{verbatim}
- Crv = CSURFACE( Srf, COL, 0.15 );
- @\end{verbatim}
- extracts an isoparametric curve in the COLumn direction at the parameter
- value of 0.15 from surface {\bf Srf}. See also CMESH, COMPOSE.
- @\subsubsection{CTANGENT}
- !CTANGENT
- @\begin{verbatim}
- VectorType CTANGENT( CurveType Curve, NumericType Param )
- @\end{verbatim}
- Computes the tangent vector to {\bf Curve} at the parameter value {\bf Param}.
- The returned vector has a unit length.
- Example:
- @\begin{verbatim}
- Tang = CTANGENT( Crv, 0.5 );
- @\end{verbatim}
- computes the tangent vector to {\bf Crv} at the parameter value of 0.5.
- @\subsubsection{CTLPT}
- !CTLPT
- @\begin{verbatim}
- CPt = CTLPT( ConstantType PtType, NumericType Coord1, ... )
- @\end{verbatim}
- Constructs a single control point to be used in the construction of curves
- and surfaces. Points can have from one to five dimensions, and may be
- either Euclidean or Projective (rational). Points' type is set via the
- constants E1 to E5 and P1 to P5. The coordinates of the point are specified
- in order, weight is first if rational.
- Examples:
- @\begin{verbatim}
- CPt1 = CTLPT( E3, 0.0, 0.0, 0.0 );
- CPt2 = CTLPT( P2, 0.707, 1.414, 1.414 );
- @\end{verbatim}
- constructs an {\bf E3} point at the origin and a P2 rational point with
- a weight of $0.707$.
- @\subsubsection{CYLIN}
- !CYLIN
- @\begin{verbatim}
- PolylineType CYLIN( VectorType Center, VectorType Direction,
- NumericType Radius )
- @\end{verbatim}
- Creates a CYLINder geometric object, defined by {\bf Center} as center of
- the base of the CYLINder, {\bf Direction} as the CYLINder's axis and height,
- and {\bf Radius} as the radius of the base of the CYLINder.
- See RESOLUTION for the accuracy of the CYLINder approximation as a
- polygonal model.
- Example:
- @\begin{verbatim}
- Cylinder1 = CYLIN( vector( 0, 0, 0 ), vector( 1, 0, 0 ), 10 );
- @\end{verbatim}
- constructs a cylinder along the $X$ axis from the origin to $X = 10$.
- @\subsubsection{CZEROS}
- !CZEROS
- @\begin{verbatim}
- ListType CZEROS( CurveType Crv, NumericType Epsilon, NumericType Axis )
- @\end{verbatim}
- Computes the zero set of the given {\bf Crv} in the given axis (1 for X,
- 2 for Y, 3 for Z). Since this computation is numeric, an {\bf Epsilon} is
- also required to specify the desired tolerance. It returns a list of
- all the parameter values (NumericType) the curve is zero.
- Example:
- @\begin{verbatim}
- xzeros = CZEROS( cb, 0.001, 1 );
- pt_xzeros = nil();
- pt = nil();
- for ( i = 1, 1, listsize( xzeros ),
- pt = ceval( cb, nth( xzeros, i ) ):
- snoc( pt, pt_xzeros )
- );
- interact( list( axes, cb, pt_xzeros ), 0);
- @\end{verbatim}
- Computes the {\bf X} zero set of curve {\bf cb} with error tolerance
- of {\bf 0.001}. This set is then scanned in a loop and evaluated to
- the curve's locations, which are then displayed.
- See also CINFLECT.
- @\subsubsection{EXTRUDE}
- !EXTRUDE
- @\begin{verbatim}
- PolygonType EXTRUDE( PolygonType Object, VectorType Dir )
- SurfaceType EXTRUDE( CurveType Object, VectorType Dir )
- @\end{verbatim}
- Creates an extrusion of the given {\bf Object}. If {\bf Object} is a
- PolygonObject, its first polygon is used as the base for the extrusion in
- {\bf Dir} direction, and a closed PolygonObject is constructed. If {\bf Object}
- is a CurveType, an extrusion surface is constructed instead, which is {\em not}
- a closed object (the two bases of the extrusion are excluded, and the curve
- may be open by itself).
- Direction {\bf Dir} cannot be coplanar with the polygon plane. The curve
- may be nonplanar.
- Example:
- @\begin{verbatim}
- Cross = cbspline( 3,
- list( ctlpt( E2, -0.018, 0.001 ),
- ctlpt( E2, 0.018, 0.001 ),
- ctlpt( E2, 0.019, 0.002 ),
- ctlpt( E2, 0.018, 0.004 ),
- ctlpt( E2, -0.018, 0.004 ),
- ctlpt( E2, -0.019, 0.001 ) ),
- list( KV_OPEN ) );
- Cross = Cross + -Cross * scale( vector( 1, -1, 1 ) );
- Napkin = EXTRUDE( Cross * scale( vector( 1.6, 1.6, 1.6 ) ),
- vector( 0.02, 0.03, 0.2 ) );
- @\end{verbatim}
- constructs a closed cross section {\bf Cross} by duplicating one half of
- it in reverse and merging the two sub-curves. {\bf Cross} is then used as
- the cross-section for the extrusion operation.
- @\subsubsection{FFCOMPAT}
- !FFCOMPAT
- @\begin{verbatim}
- FFCOMAPT( CurveType Crv1, CurveType Crv2 )
- FFCOMAPT( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Makes the given two curves or surfaces compatible by making them share the
- same point type, same curve type, same degree, and the same continuity.
- Same point type is gained by promoting a lower dimension into a higher one,
- and non-rational to rational points. Bezier curves are promoted to Bspline
- curves if necessary, for curve type compatibility. Degree compatibility is
- achieved by raising the degree of the lower order curve. Continuity is
- achieve by refining both curves to the space with the same (unioned) knot
- vector. This function returns nothing and compatibility is made
- {\em in place}.
- Example:
- @\begin{verbatim}
- FFCOMPAT( Srf1, Srf2 );
- @\end{verbatim}
- See also SMORPH.
- @\subsubsection{GBOX}
- !GBOX
- @\begin{verbatim}
- PolygonType GBOX( VectorType Point,
- VectorType Dx, VectorType Dy, VectorType Dz )
- @\end{verbatim}
- Creates a parallelepiped - Generalized BOX polygonal object, defined by
- {\bf Point} as base position, and {\bf Dx, Dy, Dz} as 3 3D vectors to define
- the 6 faces of this generalized BOX. The regular BOX object is a special case
- of GBOX where {\bf Dx} = vector(Dx, 0, 0), {\bf Dy} = vector(0, Dy, 0), and
- {\bf Dz} = vector(0, 0, Dz).
- {\bf Dx}, {\bf Dy}, {\bf Dz} must all be independent in order to create an
- object with positive volume.
- Example:
- @\begin{verbatim}
- GB = GBOX(vector(0.0, -0.35, 0.63), vector(0.5, 0.0, 0.5),
- vector(-0.5, 0.0, 0.5),
- vector(0.0, 0.7, 0.0));
- @\end{verbatim}
- @\subsubsection{GPOLYGON}
- !GPOLYGON
- @\begin{verbatim}
- PolygonType GPOLYGON( GeometryTreeType Object )
- @\end{verbatim}
- Approximates all Surface(s) in {\bf Object} with polygons using the
- RESOLUTION and FLAT4PLY variables. The larger the RESOLUTION is, the finer
- (more polygons) the resulting approximation will be.
- FLAT4PLY is a Boolean flag controlling the conversion of an (almost) flat
- patch into four (TRUE) or two (FALSE) polygons. Normals are computed to
- polygon vertices using surface normals, so Gouraud or Phong shading can be
- exploited. It returns a single polygonal object.
- Example:
- @\begin{verbatim}
- Polys = GPOLYGON( list( Srf1, Srf2, Srf3 ) );
- @\end{verbatim}
- Converts to polygons the three surfaces {\bf Srf1}, {\bf Srf2}, and {\bf Srf3}.
- @\subsubsection{GPOLYLINE}
- !GPOLYLINE
- @\begin{verbatim}
- PolylineType GPOLYLINE( GeometryTreeType Object )
- @\end{verbatim}
- Converts all Surface(s) and Curves(s) in {\bf Object} into polylines using
- the RESOLUTION variable. The larger the RESOLUTION is, the finer the resulting
- approximation will be. It returns a single polyline object.
- Example:
- @\begin{verbatim}
- Polys = GPOLYLINE( list( Srf1, Srf2, Srf3, list( Crv1, Crv2, Crv3 ) ) );
- @\end{verbatim}
- converts to polylines the three surfaces {\bf Srf1}, {\bf Srf2}, and {\bf Srf3}
- and the three curves {\bf Crv1}, {\bf Crv2}, and {\bf Crv3}.
- @\subsubsection{NIL}
- @\begin{verbatim}
- ListType NIL()
- @\end{verbatim}
- Creates an empty list so data can be accumulated in it.
- See CINFLECT or CZEROS for examples. See also LIST and SNOC.
- @\subsubsection{MERGPOLY}
- !MERGEPOLY
- @\begin{verbatim}
- PolygonType MERGEPOLY( ListType PolyList )
- @\end{verbatim}
- Merges a set of polygonal objects in {\bf PolyList} list to a single polygonal
- object. All elements in {\bf ObjectList} must be of PolygonType type. This
- function performs the same operation as the overloaded {\bf \verb+^+} operator
- would, but might be more convenient to use under some circumstances.
- Example:
- @\begin{verbatim}
- Vrtx1 = vector( -3, -2, -1 );
- Vrtx2 = vector( 3, -2, -1 );
- Vrtx3 = vector( 3, 2, -1 );
- Vrtx4 = vector( -3, 2, -1 );
- Poly1 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) );
- Vrtx1 = vector( -3, 2, 1 );
- Vrtx2 = vector( 3, 2, 1 );
- Vrtx3 = vector( 3, -2, 1 );
- Vrtx4 = vector( -3, -2, 1 );
- Poly2 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) );
- Vrtx1 = vector( -3, -2, 1 );
- Vrtx2 = vector( 3, -2, 1 );
- Vrtx3 = vector( 3, -2, -1 );
- Vrtx4 = vector( -3, -2, -1 );
- Poly3 = poly( list( Vrtx1, Vrtx2, Vrtx3, Vrtx4 ) );
- PolyObj = MERGEPOLY( list( Poly1, Poly2, Poly3 ) );
- @\end{verbatim}
- @\subsubsection{OFFSET}
- !OFFSET
- @\begin{verbatim}
- CurveType OFFSET( CurveType Crv, NumericType OffsetDistance )
- SurfaceType OFFSET( SurfaceType Srf, NumericType OffsetDistance )
- @\end{verbatim}
- Offsets {\bf Crv} or {\bf Srf}, by translating all the control points in the
- direction of the normal of the curve or surface by an {\bf OffsetDistance}
- amount. Each control point has a {\em node} parameter value associated with
- it, which is used to compute the normal. The returned curve or surface only
- approximates the real offset. One may improve the offset accuracy using
- refinement (See AOFFSET). Negative {\bf OffsetDistance} denotes offset in
- the reversed direction of the normal.
- Example:
- @\begin{verbatim}
- OffCrv = OFFSET( Crv, -0.1 );
- @\end{verbatim}
- offsets {\bf Crv} by the amount of $-0.1$ in the reversed normal direction.
- See also AOFFSET.
- @\subsubsection{PDOMAIN}
- !PDOMAIN
- @\begin{verbatim}
- ListType PDOMAIN( CurveType Crv )
- ListType PDOMAIN( SurfaceType Srf )
- @\end{verbatim}
- Returns the parametric domain of the curve (TMin, TMax) or of a surface
- (UMin, UMax, VMin, VMax) as a list object.
- Example:
- @\begin{verbatim}
- circ_domain = PDOMAIN( circle( vector( 0.0, 0.0, 0.0 ), 1.0 ) );
- @\end{verbatim}
- @\subsubsection{POLY}
- !POLY
- @\begin{verbatim}
- PolygonType POLY( ListType VrtxList, NumericType IsPolyline )
- @\end{verbatim}
- Creates a single polygon/polyline (and therefore open) object, defined by
- the vertices in {\bf VrtxList} (see LIST). All elements in {\bf VrtxList}
- must be of VectorType type. If {\bf IsPolyline}, a polyline is created,
- otherwise a polygon.
- Example:
- @\begin{verbatim}
- V1 = vector( 0.0, 0.0, 0.0 );
- V2 = vector( 0.3, 0.0, 0.0 );
- V3 = vector( 0.3, 0.0, 0.1 );
- V4 = vector( 0.2, 0.0, 0.1 );
- V5 = vector( 0.2, 0.0, 0.5 );
- V6 = vector( 0.3, 0.0, 0.5 );
- V7 = vector( 0.3, 0.0, 0.6 );
- V8 = vector( 0.0, 0.0, 0.6 );
- V9 = vector( 0.0, 0.0, 0.5 );
- V10 = vector( 0.1, 0.0, 0.5 );
- V11 = vector( 0.1, 0.0, 0.1 );
- V12 = vector( 0.0, 0.0, 0.1 );
- I = POLY( list( V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12 ),
- FALSE );
- @\end{verbatim}
- constructs an object with a single polygon in the shape of the letter I.
- @\subsubsection{PRISA}
- !PRISA
- @\begin{verbatim}
- ListType PRISA( SurfaceType Srfs, NumericType SamplesPerCurve,
- NumericType Epsilon, ConstantType Dir, VectorType Space )
- @\end{verbatim}
- Computes a layout (prisa) of the given surface(s) {\bf Srfs}, and returns
- a list of surface objects representing the layout.
- The surface is approximated to within {\bf Epsilon} in direction {\bf Dir}
- into a set of ruled surfaces and then developable surfaces that are laid out
- flat onto the $XY$ plane. If {\bf Epsilon} is negative, the piecewise ruled
- surface approximation in 3-space is returned.
- {\bf SamplesPerCurve} controls the piecewise linear approximation of the
- boundary of the ruled/developable surfaces. {\bf Space} is a vector whose
- X component controls the space between the different surfaces' layout, and
- whose Y component controls the space between different layout pieces.
- Example:
- @\begin{verbatim}
- cross = cbspline( 3,
- list( ctlpt( E3, 0.7, 0.0, 0. ),
- ctlpt( E3, 0.7, 0.0, 0.06 ),
- ctlpt( E3, 0.1, 0.0, 0.1 ),
- ctlpt( E3, 0.1, 0.0, 0.6 ),
- ctlpt( E3, 0.6, 0.0, 0.6 ),
- ctlpt( E3, 0.8, 0.0, 0.8 ),
- ctlpt( E3, 0.8, 0.0, 1.4 ),
- ctlpt( E3, 0.6, 0.0, 1.6 ) ),
- list( KV_OPEN ) );
- wglass = surfrev( cross );
- wgl_ruled = PRISA( wglass, 6, -0.1, COL, vector( 0, 0.25, 0.0 ) );
- wgl_prisa = PRISA( wglass, 6, 0.1, COL, vector( 0, 0.25, 0.0 ) );
- @\end{verbatim}
- Computes a layout of a wine glass in {\bf wgl\_prisa} and a three-dimensional
- ruled surface approximation of wglass in {\bf wgl\_ruled}.
- @\subsubsection{RULEDSRF}
- !RULEDSRF
- @\begin{verbatim}
- SurfaceType RULEDSRF( CurveType Crv1, CurveType Crv2 )
- @\end{verbatim}
- Constructs a ruled surface between the two curves {\bf Crv1} and {\bf Crv2}.
- The curves do not have to have the same order or type, and will be promoted
- to their least common denominator.
- Example:
- @\begin{verbatim}
- Circ = circle( vector( 0.0, 0.0, 0.0 ), 0.25 );
- Cyl = RULEDSRF( circ, circ * trans( vector( 0.0, 0.0, 1.0 ) ) );
- @\end{verbatim}
- Constructs a cylinder of radius 0.25 along the Z axis from 0 to 1.
- @\subsubsection{SBEZIER}
- !SBEZIER
- @\begin{verbatim}
- SurfaceType SBEZIER( ListType CtlMesh )
- @\end{verbatim}
- Creates a Bezier surface using the provided control mesh. {\bf CtlMesh} is a
- list of rows, each of which is a list of control points. All control points
- must be of the same point type.
- @The created surface is the piecewise polynomial (or rational) surface,
- @\begin{equation}
- @ S(u, v) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_i(u) B_j(v)
- @\end{equation}
- @where $P_{ij}$ are the control points {\bf CtlMesh}. and $m$ and $n$ are the
- @degrees of the surface, which are one less than the number of points in the
- @appropriate direction.
- Example:
- @\begin{verbatim}
- Srf = SBEZIER( list ( list( ctlpt( E3, 0.0, 0.0, 1.0 ),
- ctlpt( E3, 0.0, 1.0, 0.0 ),
- ctlpt( E3, 0.0, 2.0, 1.0 ) ),
- list( ctlpt( E3, 1.0, 0.0, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 2.0 ),
- ctlpt( E3, 1.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 2.0, 0.0, 2.0 ),
- ctlpt( E3, 2.0, 1.0, 0.0 ),
- ctlpt( E3, 2.0, 2.0, 2.0 ) ),
- list( ctlpt( E3, 3.0, 0.0, 0.0 ),
- ctlpt( E3, 3.0, 1.0, 2.0 ),
- ctlpt( E3, 3.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 4.0, 0.0, 1.0 ),
- ctlpt( E3, 4.0, 1.0, 0.0 ),
- ctlpt( E3, 4.0, 2.0, 1.0 ) ) ) );
- @\end{verbatim}
- @\subsubsection{SBSPLINE}
- !SBSPLINE
- @\begin{verbatim}
- SurfaceType SBSPLINE( NumericType UOrder, NumericType VOrder,
- ListType CtlMesh, ListType KnotVectors )
- @\end{verbatim}
- Creates a Bspline surface from the provided {\bf UOrder} and {\bf VOrder}
- orders, the control mesh {\bf CtlMesh}, and the two knot vectors {\bf KnotVectors}.
- {\bf CtlMesh} is a list of rows, each of which is a list of control points.
- All control points must be of the same point type. {\bf KnotVectors} is a
- list of two knot vectors. Each knot vector is a list of NumericType knots or a
- list of a single constant KV\_OPEN or KV\_FLOAT, in which a uniform knot
- vector with the appropriate length and with open or floating end condition
- will be constructed automatically.
- @The created surface is the piecewise polynomial (or rational) surface,
- @\begin{equation}
- @ S(u, v) = \sum_{i=0}^m \sum_{j=0}^n P_{ij} B_{i,\chi}(u) B_{j,\xi}(v)
- @\end{equation}
- @where $P_{ij}$ are the control points {\bf CtlMesh}, and $m$ and $n$ are the
- @degrees of the surface, which are one less than {\bf UOrder} and {\bf VOrder}.
- @$\chi$ and $\xi$ are the two knot vectors of the surface.
- Example:
- @\begin{verbatim}
- Mesh = list ( list( ctlpt( E3, 0.0, 0.0, 1.0 ),
- ctlpt( E3, 0.0, 1.0, 0.0 ),
- ctlpt( E3, 0.0, 2.0, 1.0 ) ),
- list( ctlpt( E3, 1.0, 0.0, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 2.0 ),
- ctlpt( E3, 1.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 2.0, 0.0, 2.0 ),
- ctlpt( E3, 2.0, 1.0, 0.0 ),
- ctlpt( E3, 2.0, 2.0, 2.0 ) ),
- list( ctlpt( E3, 3.0, 0.0, 0.0 ),
- ctlpt( E3, 3.0, 1.0, 2.0 ),
- ctlpt( E3, 3.0, 2.0, 0.0 ) ),
- list( ctlpt( E3, 4.0, 0.0, 1.0 ),
- ctlpt( E3, 4.0, 1.0, 0.0 ),
- ctlpt( E3, 4.0, 2.0, 1.0 ) ) );
- Srf = SBSPLINE( 3, 3, Mesh, list( list( KV_OPEN ),
- list( 3, 3, 3, 4, 5, 6, 6, 6 ) ) );
- @\end{verbatim}
- constructs a bi-quadratic Bspline surface with its first knot vector
- having uniform knot spacing with open end conditions.
- @\subsubsection{SDERIVE}
- !SDERIVE
- @\begin{verbatim}
- SurfaceType SDERIVE( SurfaceType Srf, NumericType Dir )
- @\end{verbatim}
- Returns a vector field surface representing the differentiated surface
- in the given direction (ROW or COL). Evaluation of the returned surface at
- a given parameter value will return a vector {\em tangent} to {\bf Srf} in
- {\bf Dir} at that parameter value.
- @\begin{verbatim}
- DuSrf = SDERIVE( Srf, ROW );
- DvSrf = SDERIVE( Srf, COL );
- Normal = coerce( seval( DuSrf, 0.5, 0.5 ), VECTOR_TYPE ) ^
- coerce( seval( DvSrf, 0.5, 0.5 ), VECTOR_TYPE );
- @\end{verbatim}
- computes the two partial derivatives of the surface {\bf Srf} and computes
- its normal as their cross product, at the parametric location (0.5, 0.5).
- @\subsubsection{SDIVIDE}
- !SDIVIDE
- @\begin{verbatim}
- SurfaceType SDIVIDE( SurfaceType Srf, ConstantType Direction,
- NumericType Param )
- @\end{verbatim}
- Subdivides a surface into two at the specified parameter value {\bf Param}
- in the specified {\bf Direction} (ROW or COL). {\bf Srf} can be either a Bspline
- surface in which {\bf Param} must be conatined in the parametric domain of the
- surface, or a Bezier surface in which {\bf Param} must be in the range of zero
- to one.
- It returns a list of the two sub-surfaces. The individual surfaces may be
- extracted from the list using the {\bf NTH} command.
- Example:
- @\begin{verbatim}
- SrfLst = SDIVIDE( Srf, ROW, 0.5 );
- Srf1 = nth( SrfLst, 1 );
- Srf2 = nth( SrfLst, 2 );
- @\end{verbatim}
- subdivides {\bf Srf} at the parameter value of 0.5 in the ROW direction.
- @\subsubsection{SEDITPT}
- !SEDITPT
- @\begin{verbatim}
- SurfaceType SEDITPT( SurfaceType Srf, CtlPtType CPt, NumericType UIndex,
- NumericType VIndex )
- @\end{verbatim}
- Provides a simple mechanism to manually modify a single control point number
- {\bf UIndex} and {\bf VIndex} (base count is 0) in the control mesh of {\bf Srf}
- by substituting {\bf CtlPt} instead. CtlPt must have the same point type as
- the control points of {\bf Srf}. Original surface {\bf Srf} is not modified.
- Example:
- @\begin{verbatim}
- CPt = ctlpt( E3, 1, 2, 3 );
- NewSrf = SEDITPT( Srf, CPt, 0, 0 );
- @\end{verbatim}
- constructs a {\bf NewSrf} with the first control point of {\bf Srf} being
- {\bf CPt}.
- @\subsubsection{SEVAL}
- !SEVAL
- @\begin{verbatim}
- CtlPtType SEVAL( SurfaceType Srf, NumericType UParam, NumericType VParam )
- @\end{verbatim}
- Evaluates the provided surface {\bf Srf} at the given {\bf UParam} and
- {\bf VParam} values. Both {\bf UParam} and {\bf VParam} should be contained
- in the surface parametric domain if {\bf Srf} is a Bspline surface, or
- between zero and one if {\bf Srf} is a Bezier surface. The returned control
- point has the same type as the control points of {\bf Srf}.
- Example:
- @\begin{verbatim}
- CPt = SEVAL( Srf, 0.25, 0.22 );
- @\end{verbatim}
- evaluates {\bf Srf} at the parameter values of (0.25, 0.22).
- @\subsubsection{SFROMCRVS}
- !SFROMCRVS
- @\begin{verbatim}
- SurfaceType SFROMCRVS( ListType CrvList, NumericType OtherOrder )
- @\end{verbatim}
- Constructs a surface by substituting the curves in {\bf CrvList} as rows
- in a control mesh of a surface. Curves in {\bf CrvList} are made compatible
- by promoting Bezier curves to Bsplines if necessary, and raising degree
- and refining as required before substituting the control polygons of the
- curves as rows in the mesh. The other direction order is set by
- {\bf OtherOrder}, which cannot be larger than the number of curves.
- The surface interpolates the first and last curves only.
- Example:
- @\begin{verbatim}
- Crv1 = cbspline( 3,
- list( ctlpt( E3, 0.0, 0.0, 0.0 ),
- ctlpt( E3, 1.0, 0.0, 0.0 ),
- ctlpt( E3, 1.0, 1.0, 0.0 ) ),
- list( KV_OPEN ) );
- Crv2 = Crv1 * trans( vector( 0.0, 0.0, 1.0 ) );
- Crv3 = Crv2 * scale( vector( 0.0, 0.0, 2.0 ) )
- * trans( vector( 0.1, 0.1, 0.1 ) );
- Srf = SFROMCRVS( list( Crv1, Crv2, Crv3 ), 3 );
- @\end{verbatim}
- @\subsubsection{SMERGE}
- !SMERGE
- @\begin{verbatim}
- SurfaceType SMERGE( SurfaceType Srf1, SurfaceType Srf2,
- NumericType Dir, NumericType SameEdge )
- @\end{verbatim}
- Merges two surfaces along the requested direction (ROW or COL). If
- SameEdge is non-zero (ON or TRUE), then the common edge is assumed to be
- identical and copied only once. Otherwise (OFF or FALSE), a ruled surface
- is constructed between the two surfaces along the (not) common edge.
- Example:
- @\begin{verbatim}
- MergedSrf = SMERGE( Srf1, Srf2, ROW, TRUE );
- @\end{verbatim}
- @\subsubsection{SMORPH}
- !SMORPH
- @\begin{verbatim}
- SurfaceType SMORPH( SurfaceType Srf1, SurfaceType Srf2, NumericType Blend )
- @\end{verbatim}
- Creates a new surface which is a {\em convex blend} of the two given surfaces.
- The two given surfaces must be compatible (see FFCOMPAT) before this blend
- is invoked. Very useful if a sequence that "morphs" one surface to another
- is to be created.
- Example:
- @\begin{verbatim}
- for ( i = 0.0, 1.0, 11.0,
- Msrf = SMORPH( Srf1, Srf2, i / 11.0 ):
- color( Msrf, white ):
- attrib( Msrf, "rgb", "255,255,255" ):
- attrib( Msrf, "reflect", 0.7 ):
- save( "morp1-" + i, Msrf )
- @\end{verbatim}
- creates a sequence of 12 surfaces, morphed from {\bf Srf1} to {\bf Srf2}
- and saves them in the files "morph-0.dat" to "morph-11.dat".
- @\subsubsection{SNORMAL}
- !SNORMAL
- @\begin{verbatim}
- VectorType SNORMAL( SurfaceType Srf, NumericType UParam, NumericType VParam )
- @\end{verbatim}
- Computes the normal vector to {\bf Srf} at the parameter values {\bf UParam}
- and {\bf VParam}. The returned vector has a unit length.
- Example:
- @\begin{verbatim}
- Normal = SNORMAL( Srf, 0.5, 0.5 );
- @\end{verbatim}
- computes the normal to {\bf Srf} at the parameter values (0.5, 0.5).
- See also SNRMLSRF.
- @\subsubsection{SNRMLSRF}
- !SNRMLSRF
- @\begin{verbatim}
- SurfaceType SNRMLSRF( SurfaceType Srf )
- @\end{verbatim}
- Symbolically computes a vector field surface representing the non-normalized
- normals of the given surface. That is the normal surface, evaluated at
- $(u, v)$, provides a vector in the direction of the normal of the original
- surface at $(u, v)$. The normal surface is computed as the symbolic cross
- product of the two surfaces representing the partial derivatives of the
- original surface.
- Example:
- @\begin{verbatim}
- NrmlSrf = SNRMLSRF( Srf );
- @\end{verbatim}
- @\subsubsection{SPHERE}
- !SPHERE
- @\begin{verbatim}
- PolygonType SPHERE( VectorType Center, NumericType Radius )
- @\end{verbatim}
- Creates a SPHERE geometric object, defined by {\bf Center} as the center of
- the SPHERE, and with {\bf Radius} as the radius of the SPHERE.
- See RESOLUTION for accuracy of SPHERE approximation as a polygonal model.
- @\subsubsection{SRAISE}
- !SRAISE
- @\begin{verbatim}
- SurfaceType SRAISE( SurfaceType Srf, ConstantType Direction,
- NumericType NewOrder )
- @\end{verbatim}
- Raises {\bf Srf} to the specified {\bf NewOrder} in the specified
- {\bf Direction}.
- Example:
- @\begin{verbatim}
- Srf = ruledSrf( cbezier( list( ctlpt( E3, -0.5, -0.5, 0.0 ),
- ctlpt( E3, 0.5, -0.5, 0.0 ) ) ),
- cbezier( list( ctlpt( E3, -0.5, 0.5, 0.0 ),
- ctlpt( E3, 0.5, 0.5, 0.0 ) ) ) );
- Srf = SRAISE( SRAISE( Srf, ROW, 3 ), COL, 3 );
- @\end{verbatim}
- constructs a bilinear flat ruled surface and raises both its directions to be
- a bi-quadratic surface.
- @\subsubsection{SREFINE}
- !SREFINE
- @\begin{verbatim}
- SurfaceType SREFINE( SurfaceType Srf, ConstantType Direction,
- NumericType Replace, ListType KnotList )
- @\end{verbatim}
- Provides the ability to {\bf Replace} a knot vector of {\bf Srf} or refine
- it in the specified direction {\bf Direction} (ROW or COL).
- {\bf KnotList} is a list of knots to refine {\bf Srf} at. All knots should be
- contained in the parametric domain of {\bf Srf} in {\bf Direction}. If the knot
- vector is replaced, the length of {\bf KnotList} should be identical to the
- length of the original knot vector of {\bf Srf} in {\bf Direction}. If {\bf Srf}
- is a Bezier surface, it is automatically promoted to be a Bspline surface.
- Example:
- @\begin{verbatim}
- Srf = SREFINE( SREFINE( Srf,
- ROW, FALSE, list( 0.333, 0.667 ) ),
- COL, FALSE, list( 0.333, 0.667 ) );
- @\end{verbatim}
- refines {\bf Srf} in both directions by adding two more knots at 0.333 and
- 0.667
- @\subsubsection{SREGION}
- !SREGION
- @\begin{verbatim}
- SurfaceType SREGION( SurfaceType Srf, ConstantType Direction,
- NumericType NewOrder )
- @\end{verbatim}
- Extracts a region of {\bf Srf} between {\bf MinParam} and {\bf MaxParam}
- in the specified {\bf Direction}. Both {\bf MinParam} and {\bf MaxParam}
- should be contained in the parametric domain of {\bf Srf} in {\bf Direction}.
- Example:
- @\begin{verbatim}
- SubSrf = SREGION( Srf, COL, 0.3, 0.6 );
- @\end{verbatim}
- extracts the region of {\bf Srf} from the parameter value 0.3 to the
- parameter value 0.6 along the COLumn direction. the ROW direction is
- extracted as a whole.
- @\subsubsection{STANGENT}
- !STANGENT
- @\begin{verbatim}
- VectorType STANGENT( SurfaceType Srf, ConstantType Direction,
- NumericType UParam, NumericType VParam )
- @\end{verbatim}
- Computes the tangent vector to {\bf Srf} at the parameter values {\bf UParam}
- and {\bf VParam} in {\bf Direction}. The returned vector has a unit length.
- Example:
- @\begin{verbatim}
- Tang = STANGENT( Srf, ROW, 0.5, 0.6 );
- @\end{verbatim}
- computes the tangent to {\bf Srf} in the ROW direction at the parameter
- values (0.5, 0.6).
- @\subsubsection{SURFREV}
- !SURFREV
- @\begin{verbatim}
- PolygonType SURFREV( PolygonType Object )
- SurfaceType SURFREV( CurveType Object )
- @\end{verbatim}
- Creates a surface of revolution by rotating the first polygon/curve of the
- given {\bf Object}, around the Z axis. Use the linear transformation function
- to position a surface of revolution in a different orientation.
- Example:
- @\begin{verbatim}
- VTailAntn = SURFREV( ctlpt( E3, 0.001, 0.0, 1.0 ) +
- ctlpt( E3, 0.01, 0.0, 1.0 ) +
- ctlpt( E3, 0.01, 0.0, 0.8 ) +
- ctlpt( E3, 0.03, 0.0, 0.7 ) +
- ctlpt( E3, 0.03, 0.0, 0.3 ) +
- ctlpt( E3, 0.001, 0.0, 0.0 ) );
- @\end{verbatim}
- constructs a piecewise linear Bspline curve in the XZ plane and uses it to
- construct a surface of revolution by rotating it around the Z axis.
- @\subsubsection{SWEEPSRF}
- !SWEEPSRF
- @\begin{verbatim}
- SurfaceType SWEEPSRF( CurveType CrossSection, CurveType Axis,
- NumericType Scale | CurveType ScaleCrv,
- CurveType FrameCrv | VectorType FrameVec | ConstType OFF )
- @\end{verbatim}
- Constructs a generalized cylinder surface. This function sweeps a specified
- cross-section {\bf CrossSection} along the provided {\bf Axis}.
- The cross-section may be scaled by a constant value {\bf Scale}, or scaled
- along the {\bf Axis} parametric direction via a scaling curve {\bf ScaleCrv}.
- By default, when frame specification is {\bf OFF}, the orientation
- of the cross section is computed using the {\bf Axis} curve tangent and
- normal. However, unlike the Frenet frame, attempt is made to minimize
- the normal change, as can happen along inflection points in {\bf Axis}.
- If a VectorType {\bf FrameVec} is provided as a frame orientation setting,
- it is used to fix the normal direction to this value. In other words, the
- orientation frame has a fixed normal. If a CurveType {\bf FrameCrv} is
- specified as a frame orientation setting, this vector field curve is
- evaluated at each placement of the cross-section to yield the needed normal.
- The resulting sweep is only an approximation of the real sweep. The
- scaling and axis placement will not be exact, in general.
- Refinement of the axis curve at the proper location, where accuracy is
- important, should improve the accuracy of the output. The parametric domains
- of {\bf ScaleCrv} and {\bf FrameCrv} do not have to match the parametric
- domain of {\bf Axis}, and their domains are made compatible by this function.
- Example:
- @\begin{verbatim}
- Cross = arc( vector( 0.2, 0.0, 0.0 ),
- vector( 0.2, 0.2, 0.0 ),
- vector( 0.0, 0.2, 0.0 ) ) +
- arc( vector( 0.0, 0.4, 0.0 ),
- vector( 0.1, 0.4, 0.0 ),
- vector( 0.1, 0.5, 0.0 ) ) +
- arc( vector( 0.8, 0.5, 0.0 ),
- vector( 0.8, 0.3, 0.0 ),
- vector( 1.0, 0.3, 0.0 ) ) +
- arc( vector( 1.0, 0.1, 0.0 ),
- vector( 0.9, 0.1, 0.0 ),
- vector( 0.9, 0.0, 0.0 ) ) +
- ctlpt( E2, 0.2, 0.0 );
- Axis = arc( vector( -1.0, 0.0, 0.0 ),
- vector( 0.0, 0.0, 0.1 ),
- vector( 1.0, 0.0, 0.0 ) );
- Axis = crefine( Axis, FALSE, list( 0.25, 0.5, 0.75 ) );
- ScaleCrv = cbezier( list( ctlpt( E2, 0.0, 0.01 ),
- ctlpt( E2, 1.0, 0.5 ),
- ctlpt( E2, 2.0, 0.01 ) ) );
- Srf1 = SWEEPSRF( Cross, Axis, ScaleCrv, OFF );
- Srf2 = SWEEPSRF( Cross, Axis, ScaleCrv, vector( 0.0, 1.0, 1.0 ) );
- Srf3 = SWEEPSRF( Cross, Axis, ScaleCrv,
- cbezier( list( ctlpt( E3, 1.0, 0.0, 0.0 ),
- ctlpt( E3, 0.0, 1.0, 0.0 ),
- ctlpt( E3, -1.0, 0.0, 0.0 ) ) ) );
- @\end{verbatim}
- constructs a rounded rectangle cross-section and sweeps it along an arc, while
- scaling and orienting in several ways. The axis curve {\bf Axis} is
- manually refined to better approximate the requested scaling.
- @\subsubsection{SYMBPROD}
- !SYMBPROD
- @\begin{verbatim}
- CurveType SYMBPROD( CurveType Crv1, CurveType Crv2 )
- SurfaceType SYMBPROD( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Computes the symbolic product of the given two curves or surfaces as
- a curve or surface. The product is computed coordinate-wise.
- Example:
- @\begin{verbatim}
- ProdSrf = SYMBPROD( Srf1, Srf2 )
- @\end{verbatim}
- @\subsubsection{SYMBDPROD}
- !SYMBDPROD
- @\begin{verbatim}
- CurveType SYMBDPROD( CurveType Crv1, CurveType Crv2 )
- SurfaceType SYMBDPROD( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Computes the symbolic dot (inner) product of the given two curves or surfaces
- as a {\em scalar} curve or surface.
- Example:
- @\begin{verbatim}
- DiffCrv = symbdiff( Crv1, Crv2 )
- DistSqrCrv = SYMBDPROD( DiffCrv, DiffCrv )
- @\end{verbatim}
- Computes a scalar curve that at parameter $t$ is equal to the distance
- square between Crv1 at $t$ and Crv2.
- @\subsubsection{SYMBCPROD}
- !SYMBCPROD
- @\begin{verbatim}
- CurveType SYMBCPROD( CurveType Crv1, CurveType Crv2 )
- SurfaceType SYMBCPROD( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Computes the symbolic cross product of the given two curves or surfaces as
- a curve or surface.
- Example:
- @\begin{verbatim}
- NrmlSrf = SYMBCPROD( sderive( Srf, ROW ), sderive( Srf, COL ) )
- @\end{verbatim}
- computes a normal surface as the cross product of the surface two partial
- derivatives (see SNRMLSRF).
- @\subsubsection{SYMBSUM}
- !SYMBSUM
- @\begin{verbatim}
- CurveType SYMBSUM( CurveType Crv1, CurveType Crv2 )
- SurfaceType SYMBSUM( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Computes the symbolic sum of the given two curves or surfaces as
- a curve or surface. The sum is computed coordinate-wise.
- Example:
- @\begin{verbatim}
- SumCrv = SYMBSUM( Crv1, Crv2 )
- @\end{verbatim}
- @\subsubsection{SYMBDIFF}
- !SYMBDIFF
- @\begin{verbatim}
- CurveType SYMBDIFF( CurveType Crv1, CurveType Crv2 )
- SurfaceType SYMBDIFF( SurfaceType Srf1, SurfaceType Srf2 )
- @\end{verbatim}
- Computes the symbolic difference of the given two curves or surfaces as
- a curve or surface. The difference is computed coordinate-wise.
- Example:
- @\begin{verbatim}
- DiffCrv = SYMBDIFF( Crv1, Crv2 )
- DistSqrCrv = symbdprod( DiffCrv, DiffCrv )
- @\end{verbatim}
- @\subsubsection{TORUS}
- !TORUS
- @\begin{verbatim}
- PolygonType TORUS( VectorType Center, VectorType Normal,
- NumericType MRadius, NumericType mRadius )
- @\end{verbatim}
- Creates a TORUS geometric object, defined by {\bf Center} as the center
- of the TORUS, {\bf Normal} as the normal to the main plane of the TORUS,
- {\bf MRadius} and {\bf mRadius} as the major and minor radii of the TORUS.
- See RESOLUTION for the accuracy of the TORUS approximation as a polygonal
- model.
- Example:
- @\begin{verbatim}
- T = TORUS( vector( 0.0, 0.0, 0.0), vector( 0.0, 0.0, 1.0), 0.5, 0.2 );
- @\end{verbatim}
- constructs a torus with major plane as the $XY$ plane, major radius of 0.5,
- and minor radius of 0.2.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Object transformation functions}
- &Object transformation functions
- All the routines in this section construct a 4 by 4 homogeneous
- transformation matrix representing the required transform. These matrices
- may be concatenated to achieve more complex transforms using the matrix
- multiplication operator $*$. For example, the expression
- @\begin{verbatim}
- m = trans( vector( -1, 0, 0 ) ) * rotx( 45 ) * trans( vector( 1, 0, 0 ) );
- @\end{verbatim}
- constructs a transform to rotate an object around the X = 1 line, 45 degrees.
- A matrix representing the inverse transformation can be computed as:
- @\begin{verbatim}
- InvM = m ^ -1
- @\end{verbatim}
- See also overloading of the - operator.
- @\subsubsection{HOMOMAT}
- !HOMOMAT
- @\begin{verbatim}
- MatrixType HOMOMAT( ListType MatData )
- @\end{verbatim}
- Creates an arbitrary homogeneous transformation matrix by manually providing
- its 16 coefficients.
- Example:
- @\begin{verbatim}
- for ( a = 1, 1, 720 / step,
- view_mat = save_mat *
- HOMOMAT( list( list( 1, 0, 0, 0 ),
- list( 0, 1, 0, 0 ),
- list( 0, 0, 1, -a * step / 500 ),
- list( 0, 0, 0, 1 ) ) ):
- view(list(view_mat, b, axes), on)
- @\end{verbatim}
- looping and viewing through a sequence of perspective transforms, created
- using the HOMOMAT constructor.
- @\subsubsection{ROTX}
- !ROTX
- @\begin{verbatim}
- MatrixType ROTX( NumericType Angle )
- @\end{verbatim}
- Creates a rotation around the X transformation matrix with {\bf Angle} degrees.
- @\subsubsection{ROTY}
- !ROTY
- @\begin{verbatim}
- MatrixType ROTY( NumericType Angle )
- @\end{verbatim}
- Creates a rotation around te Y transformation matrix with {\bf Angle} degrees.
- @\subsubsection{ROTZ}
- !ROTZ
- @\begin{verbatim}
- MatrixType ROTZ( NumericType Angle )
- @\end{verbatim}
- Creates a rotation around the Z transformation matrix with {\bf Angle} degrees.
- @\subsubsection{SCALE}
- !SCALE
- @\begin{verbatim}
- MatrixType SCALE( VectorType ScaleFactors )
- @\end{verbatim}
- Creates a scaling by the {\bf ScaleFactors} transformation matrix.
- @\subsubsection{TRANS}
- !TRANS
- @\begin{verbatim}
- MatrixType TRANS( VectorType TransFactors )
- @\end{verbatim}
- Creates a translation by the {\bf TransFactors} transformation matrix.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{General purpose functions}
- &General purpose functions
- @\subsubsection{ATTRIB}
- !ATTRIB
- @\begin{verbatim}
- ATTRIB( AnyType Object, StringType Name, StringType Value )
- ATTRIB( AnyType Object, StringType Name, RealType Value )
- @\end{verbatim}
- Provides a mechanism to add a string or numeric attribute to an {\bf Object},
- with name {\bf Name} and value {\bf Value}.
- These attributes may be used to pass information to other programs about
- this object, and are saved with the objects in data files. For example,
- @\begin{verbatim}
- ATTRIB(Glass, "rgb", "255,0,0");
- ATTRIB(Glass, "reflect", 1.4);
- @\end{verbatim}
- sets the RGB color of the {\bf Glass} object.
- Attribute names are case insensitive. Spaces are allowed in the {\bf Value}
- string, as well as the double quote itself, although the latter must be
- escaped:
- @\begin{verbatim}
- ATTRIB(Glass, "text", "Say \"this is me\"");
- @\end{verbatim}
- @\subsubsection{COLOR}
- !COLOR
- @\begin{verbatim}
- COLOR( GeometricType Object, NumericType Color )
- @\end{verbatim}
- Sets the color of the object to one of those specified below. Note that an
- object has a default color (see IRIT.CFG file) according to its origin -
- loaded with the LOAD command, PRIMITIVE, or BOOLEAN operation result.
- The system internally supports colors (although you may have a B\&W system)
- and the colors recognized are:
- {\bf BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, and WHITE}.
- See the ATTRIB command for more fine control of colors using the RGB
- attribute.
- @\subsubsection{COMMENT}
- !COMMENT
- @\begin{verbatim}
- COMMENT
- @\end{verbatim}
- Two types of comments are allowed:
- 1. One-line comment: starts anywhere in a line at the '\#' character, up to
- the end of the line.
- 2. Block comment: starts at the COMMENT keyword followed by a unique
- character (anything but white space), up to the second occurrence of that
- character. This is a fast way to comment out large blocks.
- Example:
- @\begin{verbatim}
- COMMENT $
- This is a comment
- $
- @\end{verbatim}
- @\subsubsection{EXIT}
- !EXIT
- @\begin{verbatim}
- EXIT();
- @\end{verbatim}
- Exits from the solid modeler. NO warning is given!
- @\subsubsection{FOR}
- @\begin{verbatim}
- FOR( NumericType Start, NumericType Increment, NumericType End, AnyType Body )
- @\end{verbatim}
- Executes the {\bf Body} (see below), while the FOR loop conditions hold.
- {\bf Start, Increment, End} are evaluated first, and the loop is executed
- while {\bf $<=$ End} if {\bf Increment $>$ 0}, or while {\bf $>=$ End} if {\bf Increment $<$ 0}.
- If {\bf Start} is of the form "Variable = Expression", then that variable is
- updated on each iteration, and can be used within the body.
- The body may consist of any number of regular commands, separated by
- COLONs, including nesting FOR loops to an arbitrary level.
- Example:
- @\begin{verbatim}
- step = 10;
- rotstepx = rotx(step);
- FOR ( a = 1, 1, 360 / step,
- view_mat = rotstepx * view_mat:
- view( list( view_mat, b, axes ), ON )
- @\end{verbatim}
- Displays b and axes with a view direction that is rotated 10 degrees at a
- time around the X axis.
- @\subsubsection{HELP}
- !HELP
- @\begin{verbatim}
- HELP( StringType Subject )
- @\end{verbatim}
- Provides help on the specified Subject.
- Example:
- @\begin{verbatim}
- HELP("");
- @\end{verbatim}
- will list all {\em IRIT} help subjects.
- @\subsubsection{FREE}
- !FREE
- @\begin{verbatim}
- FREE( GeometricType Object )
- @\end{verbatim}
- Because of the usually huge size of geometric objects, this procedure
- may be used to free them. Reassigning a value (even of different type)
- to a variable automatically releases the old variable's allocated space
- as well.
- @\subsubsection{FUNCTION}
- !FUNCTION
- @\begin{verbatim}
- FuncName = FUNCTION(Prm1, Prm2, ... , PrmN):LclVal1:LclVar2: ... :LclVarM:
- FuncBody;
- @\end{verbatim}
- Defines a function named FuncName with N parameters and M local variables
- (N, M >= 0). Here is a (simple) example of a function with no local variables
- and a single parameter that computes the square of a number:
- @\begin{verbatim}
- sqr = FUNCTION(x):
- return = x * x;
- @\end{verbatim}
- Functions can be defined with optional parameters and optional local
- variables. A function's body may contain an arbitrary set of expressions
- including for loops, (user) function calls, or even recursive function calls,
- all separated by colons.
- The returned value of the function is the value of an automatically defined
- local variable named return. The return variable is a regular local variable
- within the scope of the function and can be used as any other variable.
- If a variable's name is found in neither the local variable list nor
- the parameter list, it is searched in the global variable list (outside
- the scope of the function). Binding of names of variables is static as in the
- C programming language.
- Because binding of variables is performed in execution time, there is a
- somewhat less restrictive type checking of parameters of functions that are
- invoked within a user's defined function.
- A function can invoke itself, i.e., it can be recursive. However, since a
- function should be defined when it is called, a dummy function should be
- defined before the recursive one is defined:
- @\begin{verbatim}
- factorial = function(x):return = x; # Dummy function.
- factorial = function(x):
- if (x <= 1, return = 1, return = x * factorial(x - 1));
- @\end{verbatim}
- Overloading is valid inside a function as it is outside. For example, for
- @\begin{verbatim}
- add = FUNCTION(x, y):
- return = x + y;
- @\end{verbatim}
- the following function calls are all valid:
- @\begin{verbatim}
- add(1, 2);
- add(vector(1,2,3), point(1,2,3));
- add(box(vector(-3, -2, -1), 6, 4, 2), box(vector(-4, -3, -2), 2, 2, 4));
- @\end{verbatim}
- Finally, here is a more interesting example that computes an approximation
- of the length of a curve, using the sqr function defined above:
- @\begin{verbatim}
- distptpt = FUNCTION(pt1, pt2):
- return = sqrt(sqr(coord(pt1, 1) - coord(pt2, 1)) +
- sqr(coord(pt1, 2) - coord(pt2, 2)) +
- sqr(coord(pt1, 3) - coord(pt2, 3)));
- crvlength = FUNCTION(crv, n):pd:t:t1:t2:dt:pt1:pt2:i:
- return = 0.0:
- pd = pdomain(crv):
- t1 = nth(pd, 1):
- t2 = nth(pd, 2):
- dt = (t2 - t1) / n:
- pt1 = coerce(ceval(crv, t1), e3):
- for (i = 1, 1, n,
- pt2 = coerce(ceval(crv, t1 + dt * i), e3):
- return = return + distptpt(pt1, pt2):
- pt1 = pt2);
- @\end{verbatim}
- Try, for example:
- @\begin{verbatim}
- crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 30) / 2;
- crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 100) / 2;
- crvlength(circle(vector(0.0, 0.0, 0.0), 1.0), 300) / 2;
- @\end{verbatim}
- See PROCEDURE for more.
- @\subsubsection{IF}
- @\begin{verbatim}
- IF( NumericType Cond, AnyType TrueBody { , AnyType FalseBody } )
- @\end{verbatim}
- Executes {\bf TrueBody} (group of regular commands, separated by COLONs -
- see FOR loop) if the {\bf Cond} holds, i.e., it is a numeric value other than
- zero, or optionally, if it exists, executes {\bf FalseBody} if the {\bf Cond}
- does not hold, i.e., it evaluates to a numeric value equal to zero.
- Examples:
- @\begin{verbatim}
- IF ( machine == IBMOS2, resolution = 5, resolution = 10 );
- IF ( a > b, max = a, max = b );
- @\end{verbatim}
- sets the resolution to be 10, unless running on an IBMOS2 system, in which
- case the resolution variable will be set to 5 in the first statement, and
- set max to the maximum of a and b in the second statement.
- @\subsubsection{INCLUDE}
- !INCLUDE
- @\begin{verbatim}
- INCLUDE( StringType FileName )
- @\end{verbatim}
- Executes the script file {\bf FileName}. Nesting of include file is allowed up
- to 10 levels deep. If an error occurs, all open files in all nested files
- are closed and data are waited for at the top level (standard input).
- A script file can contain any command the solid modeler supports.
- Example:
- @\begin{verbatim}
- INCLUDE( "general.irt" );
- @\end{verbatim}
- includes the file "general.irt".
- @\subsubsection{INTERACT}
- !INTERACT
- @\begin{verbatim}
- INTERACT( GeometryTreeType Object )
- @\end{verbatim}
- A user-defined function (see iritinit.irt) that does the following,
- in order:
- @\begin{enumerate}
- @\item
- Clear the display device.
- @\item
- Display the given {\bf Object}.
- @\item
- Pause for a keystroke.
- @\end{enumerate}
- This user-defined function in version 4.0 of {\em IRIT} is an
- emulation of the INTERACT function that used to exist in previous versions.
- Example:
- @\begin{verbatim}
- INTERACT( list( view_mat, Axes, Obj ) );
- @\end{verbatim}
- displays and interacts with the object {\bf Obj} and the predefined object
- {\bf Axes}. VIEW\_MAT will be used to set the starting transformation.
- See VIEW and VIEWOBJ for more.
- @\subsubsection{LIST}
- !LIST
- @\begin{verbatim}
- ListType LIST( AnyType Elem1, AnyType Elem2, ... )
- @\end{verbatim}
- Constructs an object as a list of several other objects. Only a reference
- is made to the Elements, so modifying Elem1 after being included in the list
- will affect Elem1 in that list next time list is used!
- Each inclusion of an object in a list increases its internal {\bf used}
- reference. The object is freed iff in {\bf used} reference is zero.
- As a result, attempt to delete a variable (using FREE) which is referenced
- in a list removes the variable, but the object itself is freed only when the
- list is freed.
- @\subsubsection{LOAD}
- !LOAD
- @\begin{verbatim}
- AnyType LOAD( StringType FileName )
- @\end{verbatim}
- Loads an object from the given {\bf FileName}. The object may be any object
- defined in the system, including lists, in which the structure is recovered
- and reconstructed as well (internal objects are inserted into the global
- system object list if they have names). If no file type is provided, ".dat"
- is assumed.
- Under unix, compressed files can be loaded if the given file name has
- a postfix of ".Z". The unix system's "zcat" will be invoked via a pipe
- for that purpose.
- @\subsubsection{LOGFILE}
- !LOGFILE
- @\begin{verbatim}
- LOGFILE( NumericType Set )
- @\end{verbatim}
- If {\bf Set} is non zero (see TRUE/FALSE and ON/OFF), then everything
- printed in the input window, will go to the log file specified in the
- IRIT.CFG configuration file. This file will be created the first time
- logfile is turned ON.
- @\subsubsection{NTH}
- @\begin{verbatim}
- AnyType NTH( ListType ListObject, NumericType Index )
- @\end{verbatim}
- Returns the {\bf Index} (base count 1) element of the list {\bf ListObject}.
- Example:
- @\begin{verbatim}
- Lst = list( a, list( b, c ), d );
- Lst2 = NTH( Lst, 2 );
- @\end{verbatim}
- and now {\bf Lst2} is equal to 'list( b, c )'.
- @\subsubsection{PAUSE}
- !PAUSE
- @\begin{verbatim}
- PAUSE( NumericType Flush )
- @\end{verbatim}
- Waits for a keystroke. Nice to have if a temporary stop in a middle of an
- included file (see INCLUDE) is required. If {\bf Flush} is TRUE, then the input
- is first flushed to guarantee that the actual stop will occur.
- @\subsubsection{PRINTF}
- !PRINTF
- @\begin{verbatim}
- PRINTF( StringType CtrlStr, ListType Data )
- @\end{verbatim}
- A formatted printing routine, following the concepts of the C programming
- language's {\em printf} routine. {\bf CtrlStr} is a string object for which
- the following special '\%' commands are supported:
- #15 2 0 1
- \%d, \%i, %u
- Prints the numeric object as an integer or unsigned integer.
- \%o, \%x, \%X
- Prints the numeric object as an octal or hexadecimal integer.
- \%e, \%f, \%g,
- Prints the numeric object in several formats of
- \%E, \%F
- floating point numbers.
- Prints the string object as a string.
- \%pe, \%pf, \%pg
- Prints the three coordinates of the point object.
- \%ve, \%vf, \%vg
- Prints the three coordinates of the vector object.
- \%Pe, \%Pf, \%Pg,
- Prints the four coordinates of the plane object.
- \%De, \%Df, \%Dg,
- Prints the given object in IRIT's data file format.
- All the '\%' commands can include any modifier that is valid in the C
- programming language printf routine, including l (long), prefix
- character(s), size, etc. The point, vector, plane, and object commands
- can also be modified in a similar way, to set the format of the
- numeric data printed.
- Also supported are the newline and tab using the backslash escape
- character:
- @\begin{verbatim}
- * PRINTF("\\tThis is the char \"\\%\"\\n", nil());
- @\end{verbatim}
- Backslashes should be escaped themselves as can be seen in the above example.
- Here are few more examples:
- @\begin{verbatim}
- * PRINTF("this is a string \"%s\" and this is an integer %8d.\\n",
- * list("STRING", 1987));
- * PRINTF("this is a vector [%8.5lvf]\\n", list(vector(1,2,3)));
- * dumplvl = 9;
- * PRINTF("this is a object %8.6lDf...\\n", list(axes));
- * PRINTF("this is a object %10.8lDg...\\n", list(axes));
- @\end{verbatim}
- This implementation of PRINTF is somewhat different than the C programming
- language's version, because the backslash {\em always} escapes the next
- character during the processing stage of IRIT's parser. That is, the string
- @\begin{verbatim}
- * '\\tThis is the char \"\\%\"\\n'
- @\end{verbatim}
- is actually parsed by the IRIT's parser into
- @\begin{verbatim}
- * '\tThis is the char "\%"\n'
- @\end{verbatim}
- because this is the way the IRIT parser processes strings. The latter
- string is the one that PRINTF actually see.
- @\subsubsection{PROCEDURE}
- !PROCEDURE
- @\begin{verbatim}
- ProcName = PROCEDURE(Prm1, Prm2, ... , PrmN):LclVal1:LclVar2: ... :LclVarM:
- ProcBody;
- @\end{verbatim}
- A procedure is a function that does not return a value, and therefore the
- return variable (see FUNCTION) should not be used. A procedure is
- identical to a function in every other way. See FUNCTION for more.
- @\subsubsection{SAVE}
- !SAVE
- @\begin{verbatim}
- SAVE( StringType FileName, AnyType Object )
- @\end{verbatim}
- Saves the provided {\bf Object} in the specified file name {\bf FileName}.
- No extension type is needed (ignored if specified), and ".dat" is always
- used. {\bf Object} can be any object type, including list, in which structure
- is saved recursively. See also LOAD. If a display device is actively running
- at the time SAVE is invoked, its transformation matrix will be saved with the
- same name but with extension type of ".mat" instead of ".dat".
- Under unix, files will be saved compressed if the given file name has
- a postfix of ".Z". The unix system's "compress" will be invoked via a pipe
- for that purpose.
- @\subsubsection{SNOC}
- !SNOC
- @\begin{verbatim}
- SNOC( AnyType Object, ListType ListObject )
- @\end{verbatim}
- Similar to the lisp cons operator but puts the new {\bf Object} in the
- {\em end} of the list {\bf ListObject} instead of the beginning, in place.
- Example:
- @\begin{verbatim}
- Lst = list( axes );
- SNOC( Srf, Lst );
- @\end{verbatim}
- and now {\bf Lst} is equal to the list 'list( axes, Srf )'.
- @\subsubsection{SYSTEM}
- !SYSTEM
- @\begin{verbatim}
- SYSTEM( StringType Command )
- @\end{verbatim}
- Executes a system command {\bf Command}. For example,
- @\begin{verbatim}
- SYSTEM( "ls -l" );
- @\end{verbatim}
- @\subsubsection{TIME}
- !TIME
- @\begin{verbatim}
- TIME( NumericType Reset )
- @\end{verbatim}
- Returns the time in seconds from the last time TIME was called with
- {\bf Reset} TRUE. This time is CPU time if such support is available
- from the system (times function), and is real time otherwise (time
- function).
- The time is automatically reset at the beginning of the execution of this
- program.
- Example:
- @\begin{verbatim}
- Dummy = TIME( TRUE );
- .
- .
- .
- TIME( FALSE );
- @\end{verbatim}
- prints the time in seconds between the above two time function calls.
- @\subsubsection{VARLIST}
- !VARLIST
- @\begin{verbatim}
- VARLIST()
- @\end{verbatim}
- List all the currently defined objects in the system.
- @\subsubsection{VECTOR}
- !VECTOR
- @\begin{verbatim}
- VectorType VECTOR( NumericType X, NumericType Y, NumericType Z )
- @\end{verbatim}
- Creates a vector type object, using the three provided NumericType scalars.
- @\subsubsection{VIEW}
- !VIEW
- @\begin{verbatim}
- VIEW( GeometricTreeType Object, NumericType ClearWindow )
- @\end{verbatim}
- Displays the (geometric) object(s) as given in {\bf Object}.
- If {\bf ClearWindow} is non-zero (see TRUE/FALSE and ON/OFF) the window is
- first cleared (before drawing the objects).
- Example:
- @\begin{verbatim}
- VIEW( Axes, FALSE );
- @\end{verbatim}
- displays the predefined object {\bf Axes} in the viewing window on top of
- what is drawn already.
- In version 4.0, this function is emulated (see iritinit.irt) using the
- VIEWOBJ function. In order to use the current viewing matrix, VIEW\_MAT
- should be provided as an additional parameter. For example,
- @\begin{verbatim}
- VIEW( list( view_mat, Obj ), TRUE );
- @\end{verbatim}
- However, since VIEW is a user defined function, the following will not
- use VIEW\_MAT as one would expect:
- @\begin{verbatim}
- VIEW( view_mat, TRUE );
- @\end{verbatim}
- because VIEW\_MAT will be renamed inside the VIEW user defined function to
- a local (to the user defined function) variable.
- In iritinit.irt one can find several other useful VIEW related functions:
- # 15 2 0 1
- VIEWCLEAR
- Clears all data displayed on the display device.
- VIEWREMOVE
- Removes the object specified by name from display.
- VIEWDISC
- Disconnects from display device (which is still running)
- while allowing IRIT to connect to a new device.
- VIEWEXIT
- Forces the display device to exit.
- VIEWSAVE
- Request sdisplay device to save transformation matrix.
- BEEP
- An emulation of the BEEP command of versions prior to 4.0.
- VIEWSTATE
- Allows to change the state of the display device.
- For the above VIEW related functions, only VIEWREMOVE, VIEWSAVE, and
- VIEWSTATE require a parameter, which is the file name and view state
- respectively. The view state can be one of several commands. See the
- display device section for more.
- Examples:
- @\begin{verbatim}
- VIEWCLEAR();
- VIEW( axes, off );
- VIEWSTATE( "LngrVecs" );
- VIEWSTATE( "DrawSolid" );
- VIEWSAVE( "matrix1" );
- VIEWREMOVE( "axes" );
- VIEWDISC();
- @\end{verbatim}
- @\subsubsection{VIEWOBJ}
- !VIEWOBJ
- @\begin{verbatim}
- VIEWOBJ( GeometricTreeType Object )
- @\end{verbatim}
- Displays the (geometric) object(s) as given in {\bf Object}.
- {\bf Object} may be any GeometricType or a list of other
- GeometricTypes nested to an arbitrary level.
- Unlike {\em IRIT} versions prior to 4.0, VIEW\_MAT is not explicitly used
- as the transformation matrix. In order to display with a VIEW\_MAT view,
- VIEW\_MAT should be listed as an argument (in that exact name) to
- VIEWOBJ. Same is true for the perspective matrix PRSP\_MAT.
- Example:
- @\begin{verbatim}
- VIEWOBJ( list( view_mat, Axes ), FALSE );
- @\end{verbatim}
- displays the predefined object {\bf Axes} in the viewing window using the
- viewing matrix VIEW\_MAT.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{System variables}
- &System variables
- System variables are predefined objects in the system. Any time {\em IRIT} is
- executed, these variable are automatically defined and set to values which
- are sometimes machine dependent. These are {\em regular} objects in any other
- sense, including the ability to delete or overwrite them. One can modify,
- delete, or introduce other objects using the IRITINIT.IRT file.
- @\subsubsection{AXES}
- !AXES
- Predefined polyline object (PolylineType) that describes the $XYZ$ axes.
- @\subsubsection{COPLANAR}
- !COPLANAR
- Predefined Boolean object (NumericType). If TRUE the polygonal Boolean
- operations will support coplanar faces but is somewhat slower.
- Default is FALSE.
- @\subsubsection{DRAWCTLPT}
- !DRAWCTLPT
- Predefined Boolean variable (NumericType) that controls whether curves'
- control polygons and surfaces' control meshes are drawn (TRUE) or not
- (FALSE). Default is FALSE.
- @\subsubsection{DUMPLVL}
- !DUMPLVL
- Content of objects assigned to variables can be displayed by executing the
- command 'ObjName;' where ObjName is the name of the object. This variable
- (NumericType) controls the way the data are dumped as follows:
- # 20 2 1 1
- DumpLvl $>=$ 0
- Only object names/types are printed.
- DumpLvl $>=$ 1
- Non-geometric object values are dumped.
- DumpLvl $>=$ 2
- Curves and Surfaces are dumped.
- DumpLvl $>=$ 3
- Polygons/lines are dumped.
- DumpLvl $>=$ 4
- List objects are traversed recursively.
- Default value is 1.
- @\subsubsection{ECHOSRC}
- !ECHOSRC
- Predefined Boolean variable (NumericType) controlling echoing of
- interpreted commands to screen (TRUE) or not (FALSE). Default value is TRUE.
- @\subsubsection{FLAT4PLY}
- !FLAT4PLY
- Predefined Boolean object (NumericType) that controls the way almost flat
- surface patches are converted to polygons: four polygons (TRUE) or only
- two polygons (FALSE). Default value is FALSE.
- @\subsubsection{INTERCRV}
- !INTERCRV
- Predefined numeric object (NumericType) that if TRUE the Boolean geometry
- operators return the intersection curves instead of the result model.
- Default value is FALSE.
- @\subsubsection{MACHINE}
- !MACHINE
- Predefined numeric object (NumericType) holding the machine type as one of
- the following constants: MSDOS, SGI, HP, SUN, APOLLO, UNIX, IBMOS2, IBMNT,
- and AMIGA.
- @\subsubsection{POLYSORT}
- !POLYSORT
- Predefined numeric object (NumericType) that determines the directional
- axis along which the polygons are sorted during Boolean operations. Default is
- the $x$ axis or 0. Set to 1 for $y$ sorting. or to $2$ for $z$ sorting.
- @\subsubsection{PRSP\_MAT}
- !PRSP_MAT
- Predefined matrix object (MatrixType) to hold the perspective matrix
- used/set by VIEW and/or INTERACT commands. See also VIEW\_MAT.
- @\subsubsection{RESOLUTION}
- !RESOLUTION
- Predefined numeric object (NumericType) that sets the accuracy of the
- polygonal primitive geometric objects and the approximation of curves and
- surfaces. Holds the number of divisions a circle is divided into (with
- minimum value of 4). If, for example, RESOLUTION is set to 6, then a
- generated CONE will effectively be a six-sided pyramid.
- Also controls the fineness of freeform curves and surfaces when they are
- approximated as piecewise linear polylines, and the fineness of freeform
- surfaces when they are approximated as polygons.
- @\subsubsection{VIEW\_MAT}
- !VIEW_MAT
- Predefined matrix object (MatrixType) to hold the viewing matrix used/set
- by VIEW and/or INTERACT commands. See also PRSP\_MAT.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{System constants}
- &System constants
- The following constants are used by the various functions of the system to
- signal certain conditions. Internally, they are represented numerically,
- although, in general, their exact value is unimportant and may be changed
- in future versions. In the rare circumstance that you need to know their
- values, simply type the constant as an expression.
- Example:
- @\begin{verbatim}
- MAGENTA;
- @\end{verbatim}
- @\subsection{AMIGA}
- !AMIGA
- A constant designating an AMIGA system, in the MACHINE variable.
- @\subsubsection{APOLLO}
- !APOLLO
- A constant designating an APOLLO system, in the MACHINE variable.
- @\subsubsection{BLACK}
- !BLACK
- A constant defining a BLACK color.
- @\subsubsection{BLUE}
- !BLUE
- A constant defining a BLUE color.
- @\subsubsection{COL}
- A constant defining the COLumn direction of a surface mesh.
- @\subsubsection{CTLPT\_TYPE}
- !CTLPT_TYPE
- A constant defining an object of type control point.
- @\subsubsection{CURVE\_TYPE}
- !CURVE_TYPE
- A constant defining an object of type curve.
- @\subsubsection{CYAN}
- !CYAN
- A constant defining a CYAN color.
- @\subsubsection{E1}
- A constant defining an E1 (X only coordinate) control point type.
- @\subsubsection{E2}
- A constant defining an E2 (X and Y coordinates) control point type.
- @\subsubsection{E3}
- A constant defining an E3 (X, Y and Z coordinates) control point type.
- @\subsubsection{E4}
- A constant defining an E4 control point type.
- @\subsubsection{E5}
- A constant defining an E5 control point type.
- @\subsubsection{FALSE}
- !FALSE
- A zero constant. May be used as Boolean operand.
- @\subsubsection{GREEN}
- !GREEN
- A constant defining a GREEN color.
- @\subsubsection{HP}
- A constant designating an HP system, in the MACHINE variable.
- @\subsubsection{IBMOS2}
- !IBMOS
- A constant designating an IBM system running under OS2, in the MACHINE
- variable.
- @\subsubsection{IBMNT}
- !IBMNT
- A constant designating an IBM system running under Windows NT, in the MACHINE
- variable.
- @\subsubsection{KV\_FLOAT}
- !KV_FLOAT
- A constant defining a floating end condition uniformly spaced knot vector.
- @\subsubsection{KV\_OPEN}
- !KV_OPEN
- A constant defining an open end condition uniformly spaced knot vector.
- @\subsubsection{MAGENTA}
- !MAGENTA
- A constant defining a MAGENTA color.
- @\subsubsection{MATRIX\_TYPE}
- !MATRIX_TYPE
- A constant defining an object of type matrix.
- @\subsubsection{MSDOS}
- !MSDOS
- A constant designating an MSDOS system, in the MACHINE variable.
- @\subsubsection{NUMERIC\_TYPE}
- !NUMERIC_TYPE
- A constant defining an object of type numeric.
- @\subsubsection{OFF}
- Synonym of FALSE.
- @\subsubsection{ON}
- Synonym for TRUE.
- @\subsubsection{P1}
- A constant defining a P1 (X and W coordinates) rational control point
- type.
- @\subsubsection{P2}
- A constant defining a P2 (X, Y and W coordinates) rational control point
- type.
- @\subsubsection{P3}
- A constant defining a P3 (X, Y, Z and W coordinates) rational control
- point type.
- @\subsubsection{P4}
- A constant defining a P4 rational control
- point type.
- @\subsubsection{P5}
- A constant defining a P5 rational control
- point type.
- @\subsubsection{PI}
- The constant of 3.141592...
- @\subsubsection{PLANE\_TYPE}
- !PLANE_TYPE
- A constant defining an object of type plane.
- @\subsubsection{POINT\_TYPE}
- !POINT_TYPE
- A constant defining an object of type point.
- @\subsubsection{POLY\_TYPE}
- !POLY_TYPE
- A constant defining an object of type poly.
- @\subsubsection{RED}
- A constant defining a RED color.
- @\subsubsection{ROW}
- A constant defining the ROW direction of a surface mesh.
- @\subsubsection{SGI}
- A constant designating an SGI system, in the MACHINE variable.
- @\subsubsection{STRING\_TYPE}
- !STRING_TYPE
- A constant defining an object of type string.
- @\subsubsection{SURFACE\_TYPE}
- !SURFACE_TYPE
- A constant defining an object of type surface.
- @\subsubsection{SUN}
- A constant designating a SUN system, in the MACHINE variable.
- @\subsubsection{TRUE}
- !TRUE
- A non zero constant. May be used as Boolean operand.
- @\subsubsection{UNIX}
- !UNIX
- A constant designating a generic UNIX system, in the MACHINE variable.
- @\subsubsection{VECTOR\_TYPE}
- !VECTOR_TYPE
- A constant defining an object of type vector.
- @\subsubsection{WHITE}
- !WHITE
- A constant defining a WHITE color.
- @\subsubsection{YELLOW}
- !YELLOW
- A constant defining a YELLOW color.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Display devices}
- !Display devices
- The following display device drivers are available,
- # 16 3 0 1
- Device Name
- Invocation
- Environment
- xgldrvs
- xgldrvs -s-
- SGI 4D GL regular driver.
- xgladap
- xgladap -s-
- SGI 4D GL adaptive isocurve experminal driver.
- x11drvs
- xgldrvs -s-
- X11 driver.
- wntdrvs
- wntdrvs -s-
- IBM PC Windows NT driver.
- os2drvs
- os2drvs -s-
- IBM PC OS2 2.x driver.
- amidrvs
- amidrvs -s-
- AmigaDOS 2.04+ driver.
- nuldrvs
- nuldrvs -s- [-d] [-D]
- A device to print the object stream to stdout.
- All display devices are clients communicating with the server ({\em IRIT})
- using IPC (inter process communication). On Unix and Window NT sockets are
- used. A Windows NT client can talk to a server ({\em IRIT}) on a unix host if
- hooked to the same netwrok. On OS2 pipes are used, and both the client and
- server must run on the same machine. On AmigaDOS exec messages are used,
- and both the client and server must run on the same machine.
- The server ({\em IRIT}) will automatically start a client display device
- if the IRIT\_DISPLAY environment variable is set to the name and options of
- the display device to run. For example:
- @\begin{verbatim}
- setenv IRIT_DISPLAY xgldrvs -s-
- @\end{verbatim}
- The display device must be in a directory that is in the {\bf path}
- environment variable. Most display devices require the '-s-' flags to run
- in a non-standalone mode, or a client-server mode. Most drivers can also
- be used to display data in a standalone mode (i.e., no server). For
- example:
- @\begin{verbatim}
- xgldrvs -s solid1.dat irit.mat
- @\end{verbatim}
- Effectively, all the display devices are also data display programs
- (poly3d, which was the display program prior to version 4.0, is retired
- in 4.0). Therefore some functionality is not always as expected. For
- example, the quit button will always force the display device to quit,
- even if poped up from {\em IRIT}, but will not cause {\em IRIT} to
- quit as might logically expected. In fact, the next time {\em IRIT} will
- try to communicate with the display device, it will find the broken
- connection and will start up a new display device.
- All display devices recognize all the command line flags and all the
- configuration options in a configuration file, as described below. The display
- devices will make attemps to honor the requests, to the best of their ability.
- For example, only xgldrvs can render shaded models, and so only it will
- honor a {\bf DrawSolid} configuration options.
- @\subsection{Command Line Options}
- !Command Line Options
- @\begin{verbatim}
- ???drvs [-s] [-u] [-n] [-N] [-i] [-c] [-m] [-I #IsoLines] [-S #SampPerCrv]
- [-f FineNess] [-l LineWidth] [-d] [-D] [-L NormalLen] [-4]
- [-b BackGround] [-M] [-P] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -s}: Runs the driver in a Standalone mode. Otherwise, the driver will
- attempt to communicate with the {\em IRIT} server.
- @\item
- {\bf -u}: Forces a Unit matrix. That is, input data are {\em not}
- transformed at all.
- @\item
- {\bf -n}: Draws normals of vertices.
- @\item
- {\bf -N}: Draws normals of polygons.
- @\item
- {\bf -i}: Draws internal edges (created by {\em IRIT}) - default is not to
- display them, and this option will force displaying them as well.
- @\item
- {\bf -c}: Sets depth cueing on. Drawings that are closer to the viewer will
- be drawn in more intense color.
- @\item
- {\bf -m}: Provides some more information on the data file(s) parsed.
- @\item
- {\bf -I \#IsoLines}: Specifies number of isolines per surface, per direction.
- @\item
- {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
- (iso)curve.
- @\item
- {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
- This number is log based 2 of roughly the number of subdivisions of
- the surface in each axis.
- @\item
- {\bf -l LineWidth}: Sets the linewidth, in pixels. Default is one pixel wide.
- @\item
- {\bf -d}: Debug objects. Prints to stderr all objects read from communcation
- port with the server {\em IRIT}.
- @\item
- {\bf -D}: Debug input. Prints to stderr all characters read from communcation
- port with the server {\em IRIT}. Lowest level of communication.
- @\item
- {\bf -L NormalLen}: Sets the length of the drawn normals in thousandths of
- a unit.
- @\item
- {\bf -4}: Forces four polygons per almost flat region in the surface to
- polygon conversion. Otherwise two polygons only.
- @\item
- {\bf -b BackGround}: Sets the background color as three RGB integers in the
- range of 0 to 255.
- @\item
- {\bf -M}: Draw control mesh/polygon of curves and surfaces, as well.
- @\item
- {\bf -P}: Draws curves and surfaces (surfaces are drawn using a set of
- isocurves, see -I, or polygons, see -f).
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- @\subsection{Configuration Options}
- !Configuration Options
- The configuration file is read {\em before} the command line options are
- processed. Therefore, all options in this section can be overriden
- by the appropriate command line option, if any.
- @\begin{itemize}
- @\item
- {\bf TransPrefPos:} Preferred location (Xmin, YMin, Xmax, Ymax) of the
- transformation window.
- @\item
- {\bf ViewPrefPos:} Preferred location (Xmin, YMin, Xmax, Ymax) of the
- viewing window.
- @\item
- {\bf BackGround:} Background color. Same as '-b'.
- @\item
- {\bf Internal:} Draws internal edges. Same as '-i'.
- @\item
- {\bf DrawVNormal:} Draws normals of vertices. Same as '-n'.
- @\item
- {\bf DrawPNormal:} Draws normals of polygons. Same as '-n'.
- @\item
- {\bf MoreVerbose:} Provides some more information on the data file(s)
- parsed. Same as '-m'.
- @\item
- {\bf UnitMatrix:} Forces a Unit matrix. That is, input data are {\em not}
- transformed at all. Same as '-u'.
- @\item
- {\bf DrawSolid:} Requests a shaded surface rendering, as opposed to isocurve
- surface representation.
- @\item
- {\bf DoubleBuffer:} Requests drawing using a double buffer, if any.
- @\item
- {\bf NumOfIsolines:} Specifies number of isolines per surface, per
- direction. Same as '-I'.
- @\item
- {\bf SamplesPerCurve:} Specifies the log based 2 of number of samples per
- (iso)curve. Same as '-S'.
- @\item
- {\bf LineWidth:} Sets the linewidth, in pixels. Default is one pixel
- wide. Same as '-l'
- @\item
- {\bf AdapIsoDir:} Selects the direction of the adaptive isoline
- rendering.
- @\item
- {\bf FineNess:} Controls the fineness of the surface to polygon subdivision.
- This number is log based 2 of roughly the number of subdivisions of
- the surface in each axis. Same as '-f'.
- @\item
- {\bf DepthCue:} Set depth cueing on. Drawings that are closer to the
- viewer will be drawn in more intense color. Same as '-c'.
- @\item
- {\bf FourPerFlat:} Forces four polygons per almost flat region in the
- surface to polygon conversion. Otherwise two polygons only. Same as
- '-4'.
- @\item
- {\bf AntiAlias:} Request the drawing of anti aliased lines.
- @\item
- {\bf DrawSurfaceMesh:} Draws control mesh/polygon of curves and surfaces,
- as well. Same as '-M'.
- @\item
- {\bf DrawSurfacePoly:} Draws curves and surfaces (surfaces are drawn using
- a set of isocurves, see -I, or polygons, see -f). Same as '-P'.
- @\item
- {\bf StandAlone:} Runs the driver in a Stand alone mode. Otherwise, the
- driver will attempt to communicate with the {\em IRIT} server. Same
- as '-s'.
- @\item
- {\bf TransMode:} Selects between object space transformations and screen
- space transformation.
- @\item
- {\bf ViewMode:} Selects between perspective and orthographic views.
- @\item
- {\bf NormalLength:} Sets the length of the drawn normals in thousandths of
- a unit. Same as '-L'.
- @\item
- {\bf DebugObjects:} Debug objects. Prints to stderr all objects read
- from the communcation port with the server {\em IRIT}. Same as '-d'.
- @\item
- {\bf DebugEchoInput:} Debug input. Prints to stderr all characters read
- from the communcation port with the server {\em IRIT}. Lowest level of
- communications.
- @\end{itemize}
- @\subsection{Interactive mode setup}
- !Interactive mode setup
- Commands that affect the status of the display device can also be sent
- via the communication port with the {\em IRIT} server. The following commands
- are recognized,
- # 16 2 0 1
- {\bf CLEAR}
- Clears the display area. All objects displayed are deleted.
- {\bf DCLEAR}
- Delayed clear. Same as CLEAR but delayed until the next
- object is sent from the server. Useful for animation.
- {\bf DISCONNECT}
- Closes connection with the server, but does not quit.
- {\bf EXIT}
- Closes connection with the server and quits.
- {\bf MSAVE NAME}
- Saves the transformation matrix file by the name NAME.
- {\bf BEEP}
- Makes some sound.
- {\bf STATE COMMAND}
- Changes the state of the display device. See below.
- The following commands are valid for the STATE COMMAND above,
- # 16 2 0 1
- {\bf MoreSense:}
- More sensitive mouse control.
- {\bf LessSense:}
- Less sensitive mouse control.
- {\bf ScrnObject:}
- Toggle screen/object transformation mode.
- {\bf PerspOrtho:}
- Toggles perspective/orthographic trans. mode.
- {\bf DepthCue:}
- Toggles depth cueing drawing.
- {\bf DrawSolid:}
- Toggles isocurve/shaded solid drawing.
- {\bf DblBuffer:}
- Toggles single/double buffer mode.
- {\bf AntiAlias:}
- Toggles anti aliased lines.
- {\bf DrawIntrnl:}
- Toggles drawing of internal lines.
- {\bf DrawVNrml:}
- Toggles drawing of normals of vertices.
- {\bf DrawPNrml:}
- Toggles drawing of normals of polygons.
- {\bf DSrfMesh:}
- Toggles drawing of control meshes/polygons.
- {\bf DSrfPoly:}
- Toggles drawing of curves/surfaces.
- {\bf 4PerFlat:}
- Toggles 2/4 polygons per flat surface regions.
- {\bf MoreIso:}
- Doubles the number of isolines in a surface.
- {\bf LessIso:}
- Halves the number of isolines in a surface.
- {\bf FinrAprx:}
- Doubles the number of samples per curve.
- {\bf CrsrAprx:}
- Halves the number of samples per curve.
- {\bf LngrVecs:}
- Doubles the length of displayed normal vectors.
- {\bf ShrtrVecs:}
- Halves the length of displayed normal vectors.
- {\bf WiderLns:}
- Doubles the width of the drawn lines.
- {\bf NarrwLns:}
- Halves the width of the drawn lines.
- {\bf FinrAdapIso:}
- Doubles the number of adaptive isocurves.
- {\bf CrsrAdapIso:}
- Halves the number of adaptive isocurves.
- {\bf FinerRld:}
- Doubles the number of ruled surfaces in adaptive isocurves.
- {\bf CrsrRld:}
- Halves the number of ruled surfaces in adaptive isocurves.
- {\bf RuledSrfApx:}
- Toggles ruled surface approximation in adaptive isocurves.
- {\bf AdapIsoDir:}
- Toggles the row/col direction of adaptive isocurves.
- {\bf Front:}
- Selects a front view.
- {\bf Side:}
- Selects a side view.
- {\bf Top:}
- Selects a top view.
- {\bf Isometry:}
- Selects an isometric view.
- Obviously not all state options are valid for all drivers.
- The {\em IRIT} server defines in iritinit.irt several user-defined
- functions that exercise some of the above state commands, such as
- VIEWSTATE and VIEWSAVE.
- In addition to state modification via communication with the {\em IRIT}
- server, modes can be interactively modified on most of the display devices
- using a pop-up menu that is activated using the {\em right button in the
- transformation window}.
- This pop up menu is somewhat different in different drivers, but its
- entries closely follow the entries of the above state command table.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Utilities - General Usage}
- !Utilities - General Usage
- The {\em IRIT} solid modeler is accompanied by quite a few utilities. They
- can be subdivided into two major groups. The first includes auxiliary tools
- such as illustrt and poly3d-h. The second includes filters such as irit2ray
- and irit2ps.
- All these tools operate on input files, and most of the time produce
- data files. In all utilities that read files, the dash ('-') can be used
- to read stdin.
- Example:
- @\begin{verbatim}
- poly3d-h solid1.dat | irit2ps - > solid1.ps
- @\end{verbatim}
- All the utilities have command line options. If an option is set by a '-x'
- then '-x-' resets the option. The command line options overwrite the settings
- in config files, and the reset option is useful for cases where the option
- is set by default, in the configuration file.
- All utilities can read a sequence of data files. However, the {\em last}
- transformation matrices found (VIEW\_MAT and PRSP\_MAT) are actually used.
- Example:
- @\begin{verbatim}
- poly3d-h solid1.dat | x11drvs solid1.dat - solid1.mat
- @\end{verbatim}
- x11drvs will display the original solid1.dat file with its hidden version,
- as computed by poly3d-h, all with the solid1.mat, ignoring all other matrices
- in the data stream.
- Under unix, compressed files with a postfix ".Z" will be {\em automatically}
- uncompressed on read and write. The following is legal under unix,
- @\begin{verbatim}
- poly3d-h solid1.dat.Z | x11drvs solid1.dat.Z - solid1.mat
- @\end{verbatim}
- where solid1.dat.Z was saved from within IRIT using the command
- @\begin{verbatim}
- save( "solid1.dat.Z", solid1 );
- @\end{verbatim}
- or similar. The unix system's "compress" and "zcat" are used for the purpose
- of (un)compressing the data via pipes. See also SAVE and LOAD.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{poly3d - A Data Display Program}
- !poly3d - A Data Display Program
- This program has been retired. The display devices should be used instead.
- See the display drivers section.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{poly3d-h - Hidden Line Removing Program}
- !poly3d-h - Hidden Line Removing Program
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Introduction}
- &Introduction
- poly3d-h is a program to remove hidden lines from a given polygonal model.
- Freeform objects are preprocessed into polygons with controlled fineness.
- The program performs 4 passes over the input:
- 1. Preprocesses and maps all polygons in a scene, and sorts them.
- 2. Generates edges out of the polygonal model and sorts them (preprocessing
- for the scan line algorithm) into buckets.
- 3. Intersects edges, and splits edges with non-homogeneous visibility (the
- scan line algorithm).
- 4. Applies a visibility test of each edge.
- This program can handle CONVEX polygons only. From {\em IRIT} one can
- ensure that a model consists of convex polygons only using the CONVEX command:
- @\begin{verbatim}
- CnvxObj = convex( Obj );
- @\end{verbatim}
- just before saving it into a file. Surfaces are always decomposed into
- triangles.
- poly3d-h output is in the form of polylines. It is a regular {\em IRIT} data
- file that can be viewed using any of the display devices, for example.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- poly3d-h [-b] [-m] [-i] [-e #Edges] [-f FineNess] [-H] [-4] [-q] [-z] [-c]
- [-o OutName] DFiles > OutFile
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -b}: BackFacing - if an object is closed (such as most models created by
- {\em IRIT}), back facing polygons can be deleted, therefore speeding up
- the process by at least a factor of two.
- @\item
- {\bf -m}: More - provides some more information on the data file(s) parsed.
- @\item
- {\bf -i}: Internal edges (created by {\em IRIT}) - default is not to
- display them, and this option will force displaying them as well.
- @\item
- {\bf -e n}: Number of edges to use from each given polygon (default all).
- Handy as '-e 1 -4' for freeform data.
- @\item
- {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
- This number is log based 2 of roughly the number of subdivisions of
- the surface in each axis.
- @\item
- {\bf -H}: Dumps both visible lines and hidden lines as separated objects.
- Hidden lines will be dumped using a different (dimmer) color and (a
- narrower) line width.
- @\item
- {\bf -4}: Forces four polygons per almost flat region in the surface to
- polygon conversion. Otherwise two polygons only.
- @\item
- {\bf -q}: Quiet mode. No printing aside from fatal errors. Disables -m.
- @\item
- {\bf -o OutName}: Name of output file. Default is stdout.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\item
- {\bf -c}: Clips data to screen (default). If disabled ('-c-'), data
- outside the view screen ([-1, 1] in x and y) are also processed.
- @\end{itemize}
- Some of the options may be turned on in poly3d-h.cfg. They can be then
- turned off in the command line as '-?-'.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Configuration}
- &Configuration
- The program can be configured using a configuration file named poly3d-h.cfg.
- This is a plain ASCII file you can edit directly and set the parameters
- according to the comments there. 'poly3d-h -z' will display the current
- configuration as read from the configuration file.
- The configuration file is searched in the directory specified by the
- IRIT\_PATH environment variable. For example,
- 'setenv IRIT\_PATH /u/gershon/irit/bin/'.
- If the IRIT\_PATH variable is not set, the current directory is searched.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- As this program is not interactive, usage is quite simple, and the only
- control available is using the command line options.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{poly3d-r - A Simple Data Rendering Program}
- !poly3d-r - A Simple Data Rendering Program
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Introduction}
- &Introduction
- poly3d-r is a simple rendering program for data files created by the {\em IRIT}
- solid modeler. poly3d-r generates GIF images with 8 bits per pixel. As a
- result, rendered images are of medium quality. Although reasonably fast,
- one should consider one of several raytracing public domain programs
- available (such as RAYSHADE, for which irit2ray can generate data) for
- high quality images.
- poly3d-r uses cosine shading approximation, and flat/Gouraud interpolation.
- The program performs 4 passes over the input:
- 1. Processes the input (parsing.)
- 2. Prepares the polygons by sorting them by their Y after mapping then into
- screen space.
- 3. Evaluates colors for vertices (using polygon normals if flat shading, or
- by vertex normals for Gouraud shading).
- 4. Scans the data in a scan line fashion and dumps out the image.
- This program can handle CONVEX polygons only. From {\em IRIT} one can
- ensure that a model consists of convex polygons only using the CONVEX command:
- @\begin{verbatim}
- CnvxObj = convex( Obj );
- @\end{verbatim}
- just before saving it into a file. Surfaces are always decomposed into
- triangles.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- poly3d-r [-a Ambient] [-c N] [-l X Y Z] [-2] [-m] [-s Xsize Ysize]
- [-S SubSample] [-g] [-b] [-M Mask] [-f FineNess] [-z] DFiles > Image.gif
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -a Ambient}: Sets the ambient intensity (must be between 0.0 and 1.0).
- @\item
- {\bf -c N}: number of bits per pixel N (must be between 1 and 8 bits).
- @\item
- {\bf -l X Y Z}: specifies the light source normal direction. This vector
- does not have to be a unit vector. Only one light source is supported.
- @\item
- {\bf -2} : Forces emulation of 2 light sources at opposite directions as
- selected via [-l]. This may be useful for models that have no plane
- specified (i.e., the models has no PLANE attribute for their polygons),
- as the program guesses the equation from the points themselves, and
- which can be in the opposite of the desired direction.
- @\item
- {\bf -m}: More - provides some more information on the data file(s) parsed.
- @\item
- {\bf -s Xsize Ysize}: specifies image dimensions. As the models created by {\em IRIT}
- are mapped to a unit domain (X in [-1..1], Y in [-1..1]) by the
- viewing matrix, objects must be scaled up. The scaling up factor is
- MIN(Xsize, Ysize), which guarantees none of the original image will be
- clipped.
- @\item
- {\bf -b}: Purges back facing polygons. If the scene contains closed objects
- (such as the ones usually created by {\em IRIT}), the back facing
- polygons can be deleted. This would not change the image, but will
- speed up the process by about \%15. Using this option for incomplete
- boundary objects and/or objects with polygons with no PLANE specified
- will almost definitely create an incorrect image.
- @\item
- {\bf -g}: Use Gouraud shading interpolation (flat shading is used by default).
- This is somewhat slower, but creates nicer results.
- @\item
- {\bf -S SubSample}: subsamples, and uses a box filter to low-pass filter the
- image, using a grid size of SubSample by SubSample.
- This obviously makes things slower, but guess what - it looks much better.
- @\item
- {\bf -M Mask}: Creates a second GIF file named Mask that is a binary image set
- to 1 at any pixel covered by one of the objects, and 0 otherwise. As a
- color of an object can become equal to the background at some point,
- there is no way to find whether a pixel is representing the background
- or an object in the background color. The Mask can be used instead. This
- Mask can be used when combining images (such as the gifcomp utility in
- gif\_lib). This image is a binary alpha channel.
- @\item
- {\bf -f FineNess}: Controls the fineness of the surface to polygon subdivision.
- This number is log based 2 of roughly the number of subdivisions of
- the surface in each axis (see cagd\_lib for more).
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- The image is dumped to stdout as a GIF image which can be redirected to a
- file or piped to any program that reads GIF images from stdin.
- Some of the options may be turned on in poly3d-r.cfg. They can be then
- turned off in the command line as -?-.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Configuration}
- &Configuration
- The program can be configured using a configuration file named poly3d-r.cfg.
- This is a plain ASCII file you can edit directly and set the parameters
- according to the comments there. 'poly3d-r -z' will display the current
- configuration as read from the configuration file.
- The configuration file is searched in the directory specified by the
- IRIT\_PATH environment variable. For example
- 'setenv IRIT\_PATH /u/gershon/irit/bin/'.
- If the IRIT\_PATH variable is not set, the current directory is searched.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- As this program is not interactive, usage is quite simple, and the only
- control available is using the command lines options.
- Some Remarks:
- 1. If the input file is degenerate (2 vertices are identical, etc.), the
- degenerate data will be ignored in the next passes. Use [-m] if you want
- to know about them.
- 2. The color of the object can be extracted via the COLOR attribute as set
- via the {\em IRIT} COLOR command. In addition to this fixed set of colors, one
- can specify the color in RGB space using the ATTRIB command.
- Example:
- @\begin{verbatim}
- attrib( Srf17, "rgb", "255,155,55" );
- @\end{verbatim}
- Each of R G B must be an integer in the range [0..255].
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Illustrt - Simple line illustration filter}
- !Illustrt - Simple line illustration filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Introduction}
- &Introduction
- illustrt is a filter that processes IRIT data files and dumps out modified
- IRIT data files. illustrt can be used to make simple nice illustrations of
- data. The features of illustrt include depth sorting, hidden line clipping
- at intersection points, and vertex enhancements. illustrt is designed to
- closely interact with irit2ps, although it is not neceessary to use irit2ps
- on illustrt output.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- illustrt [-I #IsoLines] [-S #SampPerCrv] [-s] [-M] [-P] [-p]
- [-l MaxLnLen] [-a] [-t TrimInter] [-o OutName] [-T] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -I \#IsoLines}: Specifies number of isolines per surface, per direction.
- @\item
- {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
- (iso)curve.
- @\item
- {\bf -s}: sorts the data in Z depth order that emulates hidden line removal
- once the data are drawn.
- @\item
- {\bf -M}: Dumps the control mesh/polygon as well.
- @\item
- {\bf -P}: Dumps the curve/surface as isocurves.
- @\item
- {\bf -p}: Dumps vertices of polygons/lines as points.
- @\item
- {\bf -l MaxLnLen}: breaks long lines into shorter ones with maximal length
- of MaxLnLen. This option is necessary to achieve good depth depending
- line width in the '-d' option of irit2ps.
- @\item
- {\bf -a}: takes into account the angle between the two (poly)lines that
- intersect when computing how much to trim. See also -t.
- @\item
- {\bf -t TrimInter}: Each time two (poly)line segments intersect in the
- projection plane, the (poly)line that is farther away from the
- viewer is clipped TrimInter amount from both sides. See also -a.
- @\item
- {\bf -o OutName}: Name of output file. Default is stdout.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- illustrt is a simple line illustration tool. It process geometry such
- as polylines and surfaces and dumps geometry with attributes that will make
- nice line illustrations. illustrt is geared mainly toward its use with
- irit2ps to create postscript illustrations. Here is a simple example:
- @\begin{verbatim}
- illustrt -s -l 0.1 solid1.dat | irit2ps -W 0.05 -d 0.2 0.6 -u - > solid.ps
- @\end{verbatim}
- make sure all segments piped into irit2ps are shorter than 0.1 and sort them
- in order to make sure hidden surface removal is correctly applied. Irit2ps
- is invoked with depth cueing activated, and a default width of 0.05.
- illustrt dumps out regular {\em IRIT} data files, so output can be handled
- like any other data set. illustrt does the following processing to the input
- data set:
- @\begin{itemize}
- @\item
- Converts surfaces to isocurves ('-I' flag) and isocurves and curves to
- polylines ('-S' flag), and converts polygons to polylines.
- Polygonal objects are considered closed and even though each edge is
- shared by two polygons, only a single one is generated.
- @\item
- Finds the intersection location in the projection plane of all segments in
- the input data set and trims away the far segment at both sides of the
- intersection point by an amount controlled by the '-t' and '-a' flags.
- @\item
- Breaks polylines and long lines into short segments, as specified via the
- '-l' flag, so that width depth cueing can be applied more accurately
- (see irit2ps's '-d' flag) as well as the Z sorting.
- @\item
- Generates vertices of polygons in the input data set as points in output data
- controlled via the '-p' flag.
- set.
- @\item
- Applies a Z sort to the output data, if '-s', so drawing in order of the data
- will produce a properly hidden surface removal drawing.
- @\end{itemize}
- Here is a more complex example. Make sure tubular is properly set via
- "attrib(solid1, "tubular", 0.7);" and invoke:
- @\begin{verbatim}
- illustrt -s -p -l 0.1 -t 0.05 solid1.dat |
- irit2ps -W 0.05 -d 0.2 0.6 -p h 0.05 -u - > solid.ps
- @\end{verbatim}
- makes sure all segments piped into irit2ps are shorter than 0.1, generates
- points for the vertices, sorts the data in order to make sure hidden surface
- removal is correctly applied, and trims the far edge by 0.05 at an
- intersection point. Irit2ps is invoked with depth cueing activated and a
- default width of 0.05, points are drawn as hollowed circles of default
- size 0.05, and lines are drawn tubular.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Dat2Irit - Data To IRIT file filter}
- !DAT2IRIT - Data To IRIT file filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- dat2irit [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -z}: Print version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- It may be sometimes desired to convert .dat data files into a form that
- can be fed back to {\em IRIT} - a '.irt' file. This filter does exactly that.
- Example:
- @\begin{verbatim}
- dat2irit b58.dat > b58-new.irt
- @\end{verbatim}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Dxf2Irit - DXF (Autocad) To IRIT filter}
- !DXF2IRIT - DXF (Autocad) To IRIT filter
- Due to lack of real documentation on the DXF format (for surfaces), this
- filter is not really complete. It only work for polygons, and is provided
- here only for those desperate enough to try and fix it...
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Dxf - IRIT To DXF (Autocad) filter}
- !IRIT2DXF - IRIT To DXF (Autocad) filter
- Due to lack of real documentation on the DXF format (for surfaces), this
- filter is not really complete. It works only for polygons, and is provided
- here only for those desperate enough to try and fix it...
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Nff - IRIT To NFF filter}
- !IRIT2NFF - IRIT To NFF filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2nff [-l] [-4] [-c] [-f FineNess] [-o OutName] [-T] [-g] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
- by a single polygon along their linear direction.
- Although, most of the time, linear direction can be exactly represented
- using a single polygon, even a bilinear surface can have a free-form
- shape (saddle-like) that is not representable using a single polygon.
- Note that although this option will better emulate the surface shape,
- it will create unnecessary polygons in cases where one is enough.
- @\item
- {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
- @\item
- {\bf -c}: Output files should be filtered by cpp. When set, the usually
- huge geometry file is separated from the main nff file that contains
- the surface properties and view parameters. By default all data,
- including the geometry, are saved into a single file with type extension
- '.nff'. Use of '-c' will pull out all the geometry into a file with
- the same name but a '.geom' extension, which will be included using the
- '\#include' command. The '.nff' file should, in that case, be
- preprocessed using cpp before being piped into the nff renderer.
- @\item
- {\bf -f FineNess}: An integer value controlling the fineness of surface to
- polygons process. Roughly speaking, it sets the number of polygons
- along one Bezier patch direction. A Bezier patch will have order of
- $FineNess^2$ polygons then. The order of the surface also affects the
- amount of polygons; the higher the order is, the more polygons are
- created. A Bspline surface is first converted into piecewise Bezier
- to make sure C1 discontinuities will show up in the polygonal
- approximation.
- @\item
- {\bf -o OutName}: Name of output file. By default the name of the first data
- file from the {\em DFiles} list is used. See below on the output files.
- @\item
- {\bf -g}: Generates the geometry file only. See below.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Nff converts freeform surfaces into polygons in a format that can
- be used by an NFF renderer. Usually, one file is created with '.nff' type
- extension. Since the number of polygons can be extremely large, a '-c'
- option is provided, which separates the geometry from the surface
- properties and view specification, but requires preprocessing by cpp.
- The geometry is isolated in a file with extension '.geom' and included
- (via '\#include') in the main '.nff' file. The latter holds the surface
- properties for all the geometry as well as the viewing specification.
- This allows for the changing of shading or the viewing properties while
- editing small ('.nff') files.
- If '-g' is specified, only the '.geom' file is created, preserving the
- current '.nff' file. The '-g' flag can be specified only with '-c'.
- In practice, it may be useful to create a low resolution approximation
- of the model, change viewing/shading parameters in the '.nff' file until
- a good view and/or surface quality is found, and then run Irit2Nff once more
- to create a high resolution approximation of the geometry using '-g'.
- Example:
- @\begin{verbatim}
- irit2nff -c -l -f 5 b58.dat
- @\end{verbatim}
- creates b58.nff and b58.geom with low resolution (FineNess of 5).
- Once done with parameter setting, a fine approximation of the model can
- be created with:
- @\begin{verbatim}
- irit2nff -c -l -g -f 25 b58.dat
- @\end{verbatim}
- which will only recreate b58.geom (because of the -g option).
- One can overwrite the viewing matrix by appending a new matrix in the
- end of the command line, created by a display device:
- @\begin{verbatim}
- xgldrvs b58.dat
- irit2nff -l -f 5 b58.dat irit.mat
- @\end{verbatim}
- where irit.mat is the viewing matrix created by xgldrvs.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Advanced Usage}
- &Advanced Usage
- One can specify surface qualities for individual surfaces of a model.
- Several such attributes are supported by Irit2Nff and can be set within
- {\em IRIT}. See also the ATTRIB {\em IRIT} command.
- If a certain surface should be finer than the rest of the scene, one can
- set a "resolution" attribute which specifies the {\em relative} FineNess
- resolution of this specific surface.
- Example:
- @\begin{verbatim}
- attrib( srf1, "resolution", 2 );
- @\end{verbatim}
- will force srf1 to have twice the default resolution, as set via the '-f'
- flag.
- Almost flat patches are converted to polygons. The rectangle can be
- converted into two polygons (by subdividing along one of its diagonals) or
- into four by introducing a new point at the center of the patch. This
- behavior is controlled by the '-4' flag, but can be overwritten for
- individual surfaces by setting a "twoperflat" or a "fourperflat" attribute.
- NFF specific properties are controlled via the following attributes:
- "kd", "ks", "shine", "trans", "index". Refer to the NFF manual for detail.
- Example:
- @\begin{verbatim}
- attrib( srf1, "kd", 0.3 );
- attrib( srf1, "shine", 30 );
- @\end{verbatim}
- Surface color is controlled in two levels. If the object has an RGB
- attribute, it is used. Otherwise, a color, as set via the {\em IRIT} COLOR
- command, is used if set.
- Example:
- @\begin{verbatim}
- attrib( tankBody, "rgb", "244,164,96" );
- @\end{verbatim}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Plg - IRIT To PLG (REND386) filter}
- !IRIT2PLG - IRIT To PLG (REND386) filter
- PLG is the format used by the rend386 real time renderer for the IBM PC.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2plg [-l] [-4] [-f FineNess] [-T] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
- by a single polygon along their linear direction.
- Although, most of the time, linear direction can be exactly represented
- using a single polygon, even a bilinear surface can have a free form
- shape (saddle like) that is not representable using a single polygon.
- Note that although this option will better emulate the surface shape,
- it will create unnecessary polygons in cases where one is enough.
- @\item
- {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
- @\item
- {\bf -f FineNess}: An integer value controlling the fineness of surface to
- polygons process. Roughly speaking, it sets the number of polygons
- along one Bezier patch direction. A Bezier patch will have order of
- $FineNess^2$ polygons then. The order of the surface also affects the
- amount of polygons; The higher the order is, more polygons are created.
- A Bspline surface is first converted into piecewise Bezier to make
- sure C1 discontinuities will show up in the polygonal approximation.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Plg converts freeform surfaces and polygons into polygons in a
- format that can be used by the REND386 renderer.
- Example:
- @\begin{verbatim}
- irit2plg solid1.dat > solid1.plg
- @\end{verbatim}
- Surfaces are converted to polygons with fineness control:
- @\begin{verbatim}
- irit2plg -f 10 - view.mat < saddle.dat > saddle.plg
- @\end{verbatim}
- Note the use of '-' for stdin.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Ps - IRIT To PS filter}
- !IRIT2PS - IRIT To PS filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2ps [-s Size] [-I #UIso[:#VIso]] [-S #SampPerCrv] [-M] [-P]
- [-W LineWidth] [-c] [-C] [-T] [-i] [-o OutName] [-d [Zmin Zmax]]
- [-D [Zmin Zmax]] [-p PtType PtSize][-u] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -s Size}: Controls the size of the postscript output in inches.
- Default is to fill the entire screen.
- @\item
- {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
- direction. If \#VIso is not specified, \#UIso is used for \#VIso as
- well.
- @\item
- {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
- (iso)curve.
- @\item
- {\bf -M}: Dumps the control mesh/polygon as well.
- @\item
- {\bf -P}: Dumps the curve/surface as isocurves.
- @\item
- {\bf -W \#LineWidth}: Sets the line drawing width in inches. Default is
- as thin as possible. This option will overwrite only those objects
- that do {\em not} have a "width" attribute. See also -d.
- @\item
- {\bf -c}: Creates a {\em color} postscript file.
- @\item
- {\bf -C}: Curve mode. Dumps freeform curves and surfaces as cubic
- Bezier curves. Higher order curves and surfaces and/or rationals are
- approximated by cubic Bezier curves. This option generates data
- files that are roughly a third of piecewise linear postscript files
- (by disabling this feature, -C-), but takes a longer time to compute.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -i}: Internal edges (created by {\em IRIT}) - the default is not to
- display them, and this option will force displaying them as well.
- @\item
- {\bf -o OutName}: Name of output file. Default is stdout.
- @\item
- {\bf -d [Zmin Zmax]}: Sets the ratios between the depth cue and the width of
- the dumped data. See also -W, -p. Closer lines/points will be drawn
- wider/larger. Zmin and Zmax are optional. The object's bounding
- box is otherwise computed and used.
- @\item
- {\bf -D [Zmin Zmax]}: Same as -d, but depth cue the color or gray scale
- instead of width. You might need to consider the sorting option
- of the illustrt tool (-s of illustrt) for proper drawings.
- Only one of -d and -D can be used.
- @\item
- {\bf -p PtType PtSize}: Specifies the way points are drawn.
- PtType can be one of H, F, C for Hollow circle, Full Circle, or
- Cross. PtSize specifies the size of the point to be drawn, in inches.
- Vectors will also be drawn as points, but with an additional thin
- line to the origin. See also -d.
- @\item
- {\bf -u}: Forces a unit matrix transformation, i.e. no transformation.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Ps converts freeform surfaces and polygons into a postscript file.
- Example:
- @\begin{verbatim}
- irit2ps solid1.dat > solid1.ps
- @\end{verbatim}
- Surfaces are converted to polygons with fineness control:
- @\begin{verbatim}
- irit2ps -S 5 -c -W 0.01 saddle.dat > saddle.ps
- @\end{verbatim}
- creates a postscript file for the saddle model, in color, and with
- lines 0.01 inch thick.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Advanced Usage}
- &Advanced Usage
- One can specify several attributes that affect the way the postscript
- file is generated. The attributes can be generated within {\em IRIT}.
- See also the ATTRIB {\em IRIT} command.
- If a certain object should be thinner or thicker than the rest of the scene,
- one can set a "width" attribute which specifies the line width in inches of
- this specific object.
- Example:
- @\begin{verbatim}
- attrib( srf1, "width", 0.02 );
- @\end{verbatim}
- will force srf1 to have this width, instead of the default as set via the
- '-W' flag.
- If a (closed) object, a polygon for example, needs to be filled, a "fill"
- attribute should be set, with a value equal to the gray level desired.
- Example:
- @\begin{verbatim}
- attrib( poly, "fill", 0.5 );
- @\end{verbatim}
- will fill poly with \%50 gray.
- Dotted or dashed line effects can be created using a "dash" attribute which
- is a direct PostScript dash string. A simple form of this string is "[a b]"
- in which a is the drawing portion (black) in inches, followed by b inches
- of white space. See the postScript manual for more about the format of this
- string. Here is an example for a dotted-dash line.
- @\begin{verbatim}
- attrib( poly, "dash", "[0.006 0.0015 0.001 0.0015]" );
- @\end{verbatim}
- Surface color is controlled (for color postscript only - see -c) in two
- levels. If the object has an RGB attribute, it is used. Otherwise, a color as
- set via the {\em IRIT} COLOR command is used.
- Example:
- @\begin{verbatim}
- attrib( Ball, "rgb", "255,0,0" );
- @\end{verbatim}
- An object can be drawn as ``tubes'' instead of full lines. The ratio
- between the inner and the outer radii of the tube is provided as the
- TUBULAR attribute:
- @\begin{verbatim}
- attrib( final, "tubular", 0.7 );
- @\end{verbatim}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Ray - IRIT To RAYSHADE filter}
- !IRIT2RAY - IRIT To RAYSHADE filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2ray [-l] [-4] [-G GridSize] [-f FineNess] [-o OutName] [-g]
- [-p Zmin Zmax] [-P] [-M] [-T] [-I #UIso[:#VIso]] [-S #SampPerCrv]
- [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
- by a single polygon along their linear direction.
- Although most of the time, linear direction can be exactly represented
- using a single polygon, even a bilinear surface can have a free-form
- shape (saddle-like) that is not representable using a single polygon.
- Note that although this option will better emulate the surface shape,
- it will create unnecessary polygons in cases where one is enough.
- @\item
- {\bf -4}: Four - Generates four polygons per flat patch. Default is 2.
- @\item
- {\bf -G GridSize}: Usually objects are grouped as {\em lists} of polygons.
- This flags will coerce the usage of the RAYSHADE {\em grid} structure,
- with {\em GridSize} being used as the grid size along the object
- bounding box's largest dimension.
- @\item
- {\bf -f FineNess}: An integer value controlling the fineness of surface to
- polygons process. Roughly speaking, it will be set to the number of
- polygons along one Bezier patch direction. A Bezier patch will have
- order of $FineNess^2$ polygons then. The order of the surface also
- affects the amount of polygons; The higher the order is, the more
- polygons are created. A Bspline surface is first converted into
- piecewise Bezier to make sure C1 discontinuities will show up in
- the polygonal approximation.
- @\item
- {\bf -o OutName}: Name of output file. By default the name of the first data
- file from the {\em DFiles} list is used. See below on the output files.
- @\item
- {\bf -g}: Generates the geometry file only. See below.
- @\item
- {\bf -p Zmin Zmax}: Sets the ratios between the depth cue and the width of
- the dumped {\em polylines}. See also -P. Closer lines will be drawn
- wider.
- @\item
- {\bf -P}: Forces dumping polygons as polylines with thickness controlled
- by -p.
- @\item
- {\bf -M}: If -P (see -P and -p) then converts the control mesh/polygon
- to polylines which are represented as a sequence of truncated
- cones.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
- direction. If \#VIso is not specified, \#UIso is used for \#VIso as
- well.
- @\item
- {\bf -S \#SampPerCrv}: Specifies the log based 2 of the number of samples per
- (iso)curve.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Ray converts freeform surfaces into polygons in a format that can
- be used by RAYSHADE. Two files are created, one with a '.geom' extension and
- one with '.ray'. Since the number of polygons can be extremely large,
- the geometry is isolated in the '.geom' file and is included
- (via '\#include') in the main '.ray' file. The latter holds the surface
- properties for all the geometry as well as viewing and RAYSHADE specific
- commands. This allows for the changing of the shading or the viewing
- properties while editing small ('.ray') files.
- If '-g' is specified, only the '.geom' file is created, preserving the
- current '.ray' file.
- In practice, it may be useful to create a low resolution approximation
- of the model, change the viewing/shading parameters in the '.ray' file until
- a good view and/or surface quality is found, and then run Irit2Ray once more
- to create a high resolution approximation of the geometry using '-g'.
- Example:
- @\begin{verbatim}
- irit2ray -l -f 5 b58.dat
- @\end{verbatim}
- creates b58.ray and b58.geom with low resolution (FineNess of 5).
- At such low resolution it can very well may happen that triangles will have
- normals "over the edge" since a single polygon may approximate a highly
- curved surface. That will cause RAYSHADE to issue an
- "Inconsistent triangle normals" warning. This problem will not exist if
- high fineness is used.
- One can ray trace this scene using a command similar to:
- @\begin{verbatim}
- RAYSHADE -p -W 256 256 b58.ray > b58.rle
- @\end{verbatim}
- Once done with parameter setting for RAYSHADE, a fine approximation of the
- model can be created with:
- @\begin{verbatim}
- irit2ray -l -g -f 25 b58.dat
- @\end{verbatim}
- which will only recreate b58.geom (because of the -g option).
- Interesting effects can be created using the depth cue support and polyline
- conversion of irit2ray. For example
- @\begin{verbatim}
- irit2ray -G 5 -P -p -0.0 0.5 solid1.dat
- @\end{verbatim}
- will dump solid1 as a set of polylines (represented as truncated cones in
- RAYSHADE) with varying thickness according to the $z$ depth. Another example
- @\begin{verbatim}
- irit2ray -G 5 -P -p -0.1 1.0 saddle.dat
- @\end{verbatim}
- which dumps the isolines extracted from the saddle surface with varying
- thickness.
- Each time a data file is saved in {\em IRIT}, it can be saved with the
- viewing matrix of the last INTERACT by saving the VIEW\_MAT object as well.
- I.e.:
- @\begin{verbatim}
- save( "b58", b58 );
- @\end{verbatim}
- However one can overwrite the viewing matrix by appending a new matrix
- in the end of the command line, created by the display devices:
- @\begin{verbatim}
- os2drvs b58.dat
- irit2ray -l -f 5 b58.dat irit.mat
- @\end{verbatim}
- where irit.mat is the viewing matrix created by os2drvs. The output name,
- by default, is the last input file name, so you might want to provide an
- explicit name with the -o flag.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Advanced Usage}
- &Advanced Usage
- One can specify surface qualities for individual surfaces of a model.
- Several such attributes are supported by Irit2Ray and can be set within
- {\em IRIT}. See also the ATTRIB {\em IRIT} command.
- If a certain surface should be finer than the rest of the scene, one can
- set a "resolution" attribute which specifies the {\em relative} FineNess
- resolution of this specific surface.
- Example:
- @\begin{verbatim}
- attrib( srf1, "resolution", 2 );
- @\end{verbatim}
- will force srf1 to have twice the default resolution, as set via the '-f'
- flag.
- Almost flat patches are converted to polygons. The rectangle can be
- converted into two polygons (by subdividing along one of its diagonals) or
- into four by introducing a new point at the patch center. This behavior is
- controlled by the '-4' flag, but can be overwritten for individual surfaces
- bu setting "twoperflat" or "fourperflat".
- RAYSHADE specific properties are controlled via the following attributes:
- "specpow", "reflect", "transp", "body", "index", and "texture". Refer to
- RAYSHADE manual for their meaning.
- Example:
- @\begin{verbatim}
- attrib( srf1, "transp", 0.3 );
- attrib( srf1, "texture", "wood" );
- @\end{verbatim}
- Surface color is controlled in two levels. If the object has an RGB
- attribute, it is used. Otherwise a color as set via the {\em IRIT} COLOR
- command is being used if set.
- Example:
- @\begin{verbatim}
- attrib( tankBody, "rgb", "244,164,96" );
- @\end{verbatim}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Scn - IRIT To SCENE (RTrace) filter}
- !IRIT2Scn - IRIT To SCENE (RTrace) filter
- SCENE is the format used by the RTrace ray tracer. This filter was donated
- by Antonio Costa (acc@asterix.inescn.pt), the author of RTrace.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2scn [-l] [-4] [-f FineNess] [-o OutName] [-g] [-T] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -l}: Linear - forces linear (degree two) surfaces to be approximated
- as a single polygon along their linear direction.
- Although most of the time, linear direction can be exactly represented
- using a single polygon, even a bilinear surface can have a free-form
- shape (saddle-like) that is not representable using a single polygon.
- Note that although this option will better emulate the surface shape,
- it will create unnecessary polygons in cases where one is enough.
- @\item
- {\bf -4}: Four - Generates four polygons per flat patch.
- @\item
- {\bf -f FineNess}: An integer value controlling the fineness of surface to
- polygons process. Roughly speaking, it will be set to the number of
- polygons along one Bezier patch direction. A Bezier patch will have
- order of $FineNess^2$ polygons then. The order of the surface also
- affects the amount of polygons; The higher the order is, the more
- polygons are created. A Bspline surface is first converted into
- piecewise Bezier to make sure C1 discontinuities will show up in
- the polygonal approximation.
- @\item
- {\bf -o OutName}: Name of output file. By default the name of the first data
- file from {\em DFiles} list is used. See below on the output files.
- @\item
- {\bf -g}: Generates the geometry file only. See below.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Scn converts freeform surfaces and polygons into polygons in a format
- that can be used by RTrace. Two files are created, one with a '.geom'
- extension and one with '.scn'. Since the number of polygons can be extremely
- large, the geometry is isolated in the '.geom' file and is included
- (via '\#include') in the main '.scn' file. The latter holds the surface
- properties for all the geometry as well as viewing and RTrace specific
- commands. This allows for the changing of the shading or the viewing
- properties while editing small ('.scn') files.
- If '-g' is specified, only the '.geom' file is created, preserving the
- current '.scn' file.
- In practice, it may be useful to create a low resolution approximation
- of the model, change the viewing/shading parameters in the '.scn' file
- until a good view and/or surface quality is found, and then run Irit2Scn once
- more to create a high resolution approximation of the geometry using '-g'.
- Example:
- @\begin{verbatim}
- irit2scn -l -f 5 b58.dat
- @\end{verbatim}
- creates b58.scn and b58.geom with low resolution (FineNess of 5).
- One can ray trace this scene after converting the scn file to a sff file,
- using scn2sff provided with the RTrace package.
- Once done with the parameter setting of RTrace, a fine approximation of the
- model can be created with:
- @\begin{verbatim}
- irit2scn -l -g -f 25 b58.dat
- @\end{verbatim}
- which will only recreate b58.geom (because of the -g option).
- One can overwrite the viewing matrix by appending a new matrix
- in the end of the command line, created by the display devices:
- @\begin{verbatim}
- wntdrvs b58.dat
- irit2scn -l -f 5 b58.dat irit.mat
- @\end{verbatim}
- where irit.mat is the viewing matrix created by wntdrvs. The output name,
- by default, is the last input file name, so you might want to provide an
- explicit name with the -o flag.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Advanced Usage}
- &Advanced Usage
- One can specify surface qualities for individual surfaces of a model.
- Several such attributes are supported by Irit2Scn and can be set within
- {\em IRIT}. See also the ATTRIB {\em IRIT} command.
- If a certain surface should be finer than the rest of the scene, one can
- set a "resolution" attribute which specifies the {\em relative} FineNess
- resolution of this specific surface.
- Example:
- @\begin{verbatim}
- attrib( srf1, "resolution", 2 );
- @\end{verbatim}
- will force srf1 to have twice the default resolution, as set via the '-f'
- flag.
- Almost flat patches are converted to polygons. The patch can be converted
- into two polygons (by subdividing along one of its diagonals) or into four
- by introducing a new point at the patch center. This behavior is controlled
- by the '-4' flag, but can be overwritten for individual surfaces bu setting
- "twoperflat" or "fourperflat".
- RTrace specific properties are controlled via the following attributes:
- "SCNrefraction", "SCNtexture", "SCNsurface. Refer to the RTrace manual for
- their meaning.
- Example:
- @\begin{verbatim}
- attrib( srf1, "SCNrefraction", 0.3 );
- @\end{verbatim}
- Surface color is controlled in two levels. If the object has an RGB
- attribute, it is used. Otherwise a color as set via {\em IRIT} COLOR command
- is used if set.
- Example:
- @\begin{verbatim}
- attrib( tankBody, "rgb", "244,164,96" );
- @\end{verbatim}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Irit2Xfg - IRIT To XFIG filter}
- !IRIT2Xfg - IRIT To XFIG filter
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Command Line Options}
- &Command line options
- @\begin{verbatim}
- irit2xfg [-s Size] [-t XTrans YTrans] [-I #UIso[:#VIso]] [-S #SampPerCrv]
- [-M] [-P] [-T] [-i] [-o OutName] [-z] DFiles
- @\end{verbatim}
- @\begin{itemize}
- @\item
- {\bf -s Size}: Size in inches of the page. Default is 7 inches.
- @\item
- {\bf -t XTrans YTrans}: X and Y translation. of the image. Default is (0, 0).
- @\item
- {\bf -I \#UIso[:\#VIso]}: Specifies the number of isolines per surface, per
- direction. If \#VIso is not specified, \#UIso is used for \#VIso as
- well.
- @\item
- {\bf -S \#SampPerCrv}: Specifies the log based 2 of number of samples per
- (iso)curve.
- @\item
- {\bf -M}: Dumps the control mesh/polygon as well.
- @\item
- {\bf -P}: Dumps the curve/surface as isocurves.
- @\item
- {\bf -T}: Talkative mode. Prints processing information.
- @\item
- {\bf -i}: Internal edges (created by {\em IRIT}) - default is not to
- display them, and this option will force displaying them as well.
- @\item
- {\bf -o OutName}: Name of output file. By default the name of the first data
- file from {\em DFiles} list is used. See below on the output files.
- @\item
- {\bf -z}: Prints version number and current defaults.
- @\end{itemize}
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\subsection{Usage}
- &Usage
- Irit2Xfg converts freeform surfaces and polygons into polylines in a format
- that can be used by XFIG.
- Example:
- @\begin{verbatim}
- irit2Xfg -l -f 15 saddle.dat > saddle.xfg
- @\end{verbatim}
- However, one can overwrite the viewing matrix by appending a new matrix
- in the end of the command line, created by the display devices:
- @\begin{verbatim}
- x11drvs b58.dat
- irit2Xfg -l -f 5 b58.dat irit.mat > saddle.xfg
- @\end{verbatim}
- where irit.mat is the viewing matrix created by x11drvs.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- @\section{Data File Format}
- !DATAFILE Format
- This section describes the data file format used to exchange data between
- {\em IRIT} and its accompanying tools.
- @\begin{verbatim}
- [OBJECT {ATTRS} OBJNAME
- [NUMBER n]
- | [VECTOR x y z]
- | [CTLPT POINT_TYPE {w} x y {z}]
- | [STRING "a string"]
- | [MATRIX m00 ... m03
- m10 ... m13
- m20 ... m23
- m30 ... m33]
- ;A polyline should be drawn from first point to last. Nothing is drawn
- ;from last to first (in a closed polyline, last point is equal to first).
- | [POLYLINE {ATTRS} #PTS ;#PTS = number of points.
- [{ATTRS} x y z]
- [{ATTRS} x y z]
- .
- .
- .
- [{ATTRS} x y z]
- ]
- ;Defines a closed planar region. Last point is NOT equal to first,
- ;and a line from last point to first should be drawn when the boundary
- ;of the polygon is drawn.
- | [POLYGON {ATTRS} #PTS
- [{ATTRS} x y z]
- [{ATTRS} x y z]
- .
- .
- .
- [{ATTRS} x y z]
- ]
- ;Defines a "cloud" of points.
- | [POINTLIST {ATTRS} #PTS
- [{ATTRS} x y z]
- [{ATTRS} x y z]
- .
- .
- .
- [{ATTRS} x y z]
- ]
- ;Defines a Bezier curve with #PTS control points. If the curve is
- ;rational, the rational component is introduced first.
- | [CURVE BEZIER {ATTRS} #PTS POINT_TYPE
- [{ATTRS} {w} x y z ...]
- [{ATTRS} {w} x y z ...]
- .
- .
- .
- [{ATTRS} {w} x y z ...]
- ]
- ;Defines a Bezier surface with #UPTS * #VPTS control points. If the
- ;surface is rational, the rational component is introduced first.
- ;Points are printed row after row (#UPTS per row), #VPTS rows.
- | [SURFACE BEZIER {ATTRS} #UPTS #VPTS POINT_TYPE
- [{ATTRS} {w} x y z ...]
- [{ATTRS} {w} x y z ...]
- .
- .
- .
- [{ATTRS} {w} x y z ...]
- ]
- ;Defines a Bspline curve of order ORDER with #PTS control points. If the
- ;curve is rational, the rational component is introduced first.
- ;Note length of knot vector is equal to #PTS + ORDER.
- | [CURVE BSPLINE {ATTRS} #PTS ORDER POINT_TYPE
- [KV {ATTRS} kv0 kv1 kv2 ...] ;Knot vector
- [{ATTRS} {w} x y z ...]
- [{ATTRS} {w} x y z ...]
- .
- .
- .
- [{ATTRS} {w} x y z ...]
- ]
- ;Defines a Bspline surface with #UPTS * #VPTS control points, of order
- ;UORDER by VORDER. If the surface is rational, the rational component
- ;is introduced first.
- ;Points are printed row after row (#UPTS per row), #VPTS rows.
- | [SURFACE BSPLINE {ATTRS} #UPTS #VPTS UORDER VORDER POINT_TYPE
- [KV {ATTRS} kv0 kv1 kv2 ...] ;U Knot vector
- [KV {ATTRS} kv0 kv1 kv2 ...] ;V Knot vector
- [{ATTRS} {w} x y z ...]
- [{ATTRS} {w} x y z ...]
- .
- .
- .
- [{ATTRS} {w} x y z ...]
- ]
- POINT_TYPE -> E1 | E2 | E3 | E4 | E5 | P1 | P2 | P3 | P4 | P5
- ATTRS -> [ATTRNAME ATTRVALUE]
- | [ATTRNAME]
- | [ATTRNAME ATTRVALUE] ATTRS
- @\end{verbatim}
- Some notes:
- * This definition for the text file is designed to minimize the
- reading time and space. All information can be read without backward
- or forward referencing.
- * An OBJECT must not hold different geometry or other entities.
- I.e. CURVEs, SURFACEs, and POLYGONs must all be in different OBJECTs.
- * Attributes should be ignored if not needed. The attribute list may have
- any length and is always terminated by a token that is NOT '\verb+[+'. This
- simplifies and disambiguates the parsing.
- * Comments may appear between '\verb+[+OBJECT ...\verb+]+' blocks, or
- immediately after OBJECT OBJNAME, and only there.
- A comment body can be anything not containing the '\verb+[+' or the
- '\verb+]+' tokens (signals start/end of block). Some of the comments in
- the above definition are {\em illegal} and appear there only of the sake
- of clarity.
- * It is preferred that geometric attributes such as NORNALs will be saved in
- the geometry structure level (POLYGON, CURVE or vertices) while graphical
- and others such as COLORs will be saved in the OBJECT level.
- * Objects may be contained in other objects to an arbitrary level.
- Here is an example that exercises most of the data format:
- @\begin{verbatim}
- This is a legal comment in a data file.
- [OBJECT DEMO
- [OBJECT REAL_NUM
- And this is also a legal comment.
- [NUMBER 4]
- ]
- [OBJECT A_VECTOR
- [VECTOR 1 2 3]
- ]
- [OBJECT CTL_POINT
- [CTLPT E3 1 2 3]
- ]
- [OBJECT STR_OBJ
- [STRING "string"]
- ]
- [OBJECT UNIT_MAT
- [MATRIX
- 1 0 0 0
- 0 1 0 0
- 0 0 1 0
- 0 0 0 1
- ]
- ]
- [OBJECT [COLOR 4] POLY1OBJ
- [POLYGON [PLANE 1 0 0 0.5] 4
- [-0.5 0.5 0.5]
- [-0.5 -0.5 0.5]
- [-0.5 -0.5 -0.5]
- [-0.5 0.5 -0.5]
- ]
- [POLYGON [PLANE 0 -1 0 0.5] 4
- [0.5 0.5 0.5]
- [-0.5 0.5 0.5]
- [-0.5 0.5 -0.5]
- [0.5 0.5 -0.5]
- ]
- ]
- [OBJECT [COLOR 63] ACURVE
- [CURVE BSPLINE 16 4 E2
- [KV 0 0 0 0 1 1 1 2 3 4 5 6 7 8 9 10 11 11 11 11]
- [0.874 0]
- [0.899333 0.0253333]
- [0.924667 0.0506667]
- [0.95 0.076]
- [0.95 0.76]
- [0.304 1.52]
- [0.304 1.9]
- [0.494 2.09]
- [0.722 2.242]
- [0.722 2.318]
- [0.38 2.508]
- [0.418 2.698]
- [0.57 2.812]
- [0.57 3.42]
- [0.19 3.572]
- [0 3.572]
- ]
- ]
- [OBJECT [COLOR 2] SOMESRF
- [SURFACE BEZIER 3 3 E3
- [0 0 0]
- [0.05 0.2 0.1]
- [0.1 0.05 0.2]
- [0.1 -0.2 0]
- [0.15 0.05 0.1]
- [0.2 -0.1 0.2]
- [0.2 0 0]
- [0.25 0.2 0.1]
- [0.3 0.05 0.2]
- ]
- ]
- @\end{verbatim}
- @\section{Bugs and Limitations}
- !BUGS and LIMITATIONS
- Like any program of more than one line, it is far from being perfect.
- Some limitations, as well as simplifications, are laid out below.
- 1. If the intersection curve of two objects falls exactly on polygon
- boundaries, for all polygons, the system will scream that the two objects
- do not intersect at all. Try to move one by EPSILON into the other.
- I probably should fix this one - it is supposed to be relatively easy.
- 2. Avoid degenerate intersections that result with a point or a line.
- They will probably cause wrong propagation of the inner and outer part of
- one object relative to the other. Always extend your object beyond the
- other object.
- 3. If two objects have no intersection in their boundary, {\em IRIT} assumes they
- are disjoint: a union simply combines them, and the other Boolean
- operators return a NULL object. One should find a FAST way (3D Jordan
- theorem) to find the relation between the two (A in B, B in A, A
- disjoint B) and according to that, make a decision.
- 4. Sweep of a circular curve along a circular curve does {\em not} create an
- exact piece of a torus.
- 5. Since the boolean sum implementation constructs ruled surfaces with
- uniform speed, it might return a somewhat incorrect answer, given
- non-uniform input curves.
- 6. The parser is out of hand and is difficult to maintain. There are several
- memory leaks there that one should fix.
- 7. The X11 driver has no menu support (any easy way to have menus using
- Xlib!?).
- 8. IBM R6000 fails to run the drivers in -s- mode.
- 9. Rayshade complains a lot about degenerate polygons on irit2ray output.
- To alleviate the problem, change the 'equal' macro in common.h in libcommon
- of rayshade from EPSILON (1e-5) to 1e-7 or even lower.
- @\end{document}
-